extragear/graphics/digikam/utilities/setup

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam/utilities/setup

F.J.Cruz
SVN commit 508063 by fjcruz:

Following the suggestions from Tom, if the default path to the color profiles directory is empty, the ok button is disabled and a message is showed.

CCMAIL:[hidden email]

 M  +1 -1      setup.cpp  
 M  +45 -12    setupicc.cpp  
 M  +3 -1      setupicc.h  


--- trunk/extragear/graphics/digikam/utilities/setup/setup.cpp #508062:508063
@@ -151,7 +151,7 @@
     
     d->page_icc = addPage(i18n("ICC Profiles"), i18n("Image Editor ICC Profiles Management"),
                        BarIcon("colorize", KIcon::SizeMedium));
-    d->iccPage = new SetupICC(d->page_icc);
+    d->iccPage = new SetupICC(d->page_icc, this);
 
     d->page_plugins = addPage(i18n("Kipi Plugins"), i18n("Main Interface Plugins"),
                            BarIcon("kipi", KIcon::SizeMedium));
--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.cpp #508062:508063
@@ -43,6 +43,7 @@
 
 #include <klocale.h>
 #include <kdialog.h>
+#include <kdialogbase.h>
 #include <kurlrequester.h>
 #include <kconfig.h>
 #include <kcombobox.h>
@@ -110,14 +111,18 @@
     KComboBox       *renderingIntentKC;
 
     ICCfilesPath     ICCPath;
+
+    KDialogBase     *mainDialog;
 };
 
-SetupICC::SetupICC(QWidget* parent )
+SetupICC::SetupICC(QWidget* parent, KDialogBase* dialog )
         : QWidget(parent)
 {
 //     QVBoxLayout *mainLayout = new QVBoxLayout(parent);
     d = new SetupICCPriv();
 
+    d->mainDialog = dialog;
+
     QVBoxLayout *layout = new QVBoxLayout( parent, 0, KDialog::spacingHint());
 
    // --------------------------------------------------------
@@ -286,15 +291,15 @@
     }
 //     config->writeEntry("ApplyICC", d->defaultApplyICC->isChecked());
 //     config->writeEntry("AskICC", d->defaultAskICC->isChecked());
-    if (d->defaultPathKU->url().isEmpty())
-    {
-        QString message = QString(i18n("<p>You must set a default path to color profiles files.</p>"));
-        message.append(i18n("<p>This settings will not be written.</p>"));
-        KMessageBox::error(this, message );
-        config->writeEntry("EnableCM", false);
-        config->sync();
-        return;
-    }
+//     if (d->defaultPathKU->url().isEmpty())
+//     {
+//         QString message = QString(i18n("<p>You must set a default path to color profiles files.</p>"));
+//         message.append(i18n("<p>This settings will not be written.</p>"));
+//         KMessageBox::error(this, message );
+//         config->writeEntry("EnableCM", false);
+//         config->sync();
+//         return;
+//     }
     config->writePathEntry("DefaultPath", d->defaultPathKU->url());
     config->writeEntry("WorkSpaceProfile", d->workProfilesKC->currentItem());
     config->writeEntry("MonitorProfile", d->monitorProfilesKC->currentItem());
@@ -370,10 +375,19 @@
     const QFileInfoList* files = profilesDir.entryInfoList();
     QStringList m_monitorICCFiles_description=0, m_inICCFiles_description=0, m_proofICCFiles_description=0, m_workICCFiles_description=0;
 
+
+//     if (files->isEmpty())
+//     {
+//         d->mainDialog->enableButtonOK(false);
+//         KMessageBox::sorry(this, i18n("<p>It seems there are no color profiles in this path</p>"));
+//         return;
+//     }
+//     else
     if (files)
     {
         QFileInfoListIterator it(*files);
         QFileInfo *fileInfo;
+//         d->mainDialog->enableButtonOK(true);
 
         while ((fileInfo = it.current()) != 0)
         {
@@ -412,7 +426,7 @@
     }
     else
     {
-      kdDebug() << "no list" << endl;
+        kdDebug() << "No List" << endl;
     }
     d->inProfilesKC->insertStringList(m_inICCFiles_description);
     d->monitorProfilesKC->insertStringList(m_monitorICCFiles_description);
@@ -423,9 +437,11 @@
 void SetupICC::slotToggledWidgets(bool t)
 {
     d->bpcAlgorithm->setEnabled(t);
+    d->bpcAlgorithm->setChecked(t);
 
     d->defaultApplyICC->setEnabled(t);
     d->defaultAskICC->setEnabled(t);
+    d->defaultAskICC->setChecked(t);
     d->defaultApplyICC->setChecked(t);
     
     d->defaultPathKU->setEnabled(t);
@@ -468,6 +484,15 @@
 void SetupICC::slotFillCombos(const QString& url)
 {
     cmsHPROFILE tmpProfile=0;
+
+    if (url.isEmpty())
+    {
+        d->mainDialog->enableButtonOK(false);
+        KMessageBox::sorry(this, i18n("<p>You must set a default path to color profiles files.</p>"));
+        return;
+    }
+    d->mainDialog->enableButtonOK(true);
+    
     QDir profilesDir(QFile::encodeName(url), "*.icc;*.icm", QDir::Files);
 
 
@@ -480,10 +505,18 @@
     const QFileInfoList* files = profilesDir.entryInfoList();
     QStringList m_monitorICCFiles_description=0, m_inICCFiles_description=0, m_proofICCFiles_description=0, m_workICCFiles_description=0;
 
+//     if (files->isEmpty())
+//     {
+//         d->mainDialog->enableButtonOK(false);
+//         KMessageBox::sorry(this, i18n("<p>It seems there are no color profiles in this path</p>"));
+//         return;
+//     }
+//     else
     if (files)
     {
         QFileInfoListIterator it(*files);
         QFileInfo *fileInfo;
+//         d->mainDialog->enableButtonOK(true);
 
         m_inICCFiles_description.clear();
         d->inICCFiles_file.clear();
@@ -529,7 +562,7 @@
     }
     else
     {
-      kdDebug() << "no list" << endl;
+        kdDebug() << "No list" << endl;
     }
     d->inProfilesKC->clear();
     d->inProfilesKC->insertStringList(m_inICCFiles_description);
--- trunk/extragear/graphics/digikam/utilities/setup/setupicc.h #508062:508063
@@ -28,6 +28,8 @@
 #include <qwidget.h>
 #include <qmap.h>
 
+class KDialogBase;
+
 namespace Digikam
 {
 
@@ -39,7 +41,7 @@
 
 public:
 
-    SetupICC(QWidget* parent = 0);
+    SetupICC(QWidget* parent = 0, KDialogBase* dialog = 0);
     ~SetupICC();
 
     void applySettings();
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel