[Digikam-devel] branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor

Gilles Caulier caulier.gilles at gmail.com
Fri Jan 4 14:59:53 GMT 2008


SVN commit 757242 by cgilles:

digiKam from KDE3 branch : usability improvement with Save Image dialog from editor : remember the last file format used in preview session to save an image.
CCMAIL: digikam-devel at kde.org


 M  +16 -7     editorwindow.cpp  


--- branches/extragear/kde3/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #757241:757242
@@ -1505,20 +1505,26 @@
                                     false,
                                     options);
 
+    connect(&imageFileSaveDialog, SIGNAL(filterChanged(const QString &)),
+            options, SLOT(slotImageFileFormatChanged(const QString &)));
+
+    connect(&imageFileSaveDialog, SIGNAL(fileSelected(const QString &)),
+            options, SLOT(slotImageFileSelected(const QString &)));
+
     imageFileSaveDialog.setOperationMode(KFileDialog::Saving);
     imageFileSaveDialog.setMode(KFile::File);
-    imageFileSaveDialog.setSelection(m_savingContext->srcURL.fileName());
     imageFileSaveDialog.setCaption(i18n("New Image File Name"));
     imageFileSaveDialog.setFilter(mimetypes);
 
-    connect(&imageFileSaveDialog, SIGNAL(filterChanged(const QString &)),
-            options, SLOT(slotImageFileFormatChanged(const QString &)));
+    QFileInfo info(m_savingContext->srcURL.fileName());
+    KConfig* config = kapp->config();
+    config->setGroup("ImageViewer Settings");
+    QString ext      = config->readEntry("LastSavedImageTypeMime", "png");
+    QString fileName = info.baseName(false) + QString(".") + ext;
+    imageFileSaveDialog.setSelection(fileName);
 
-    connect(&imageFileSaveDialog, SIGNAL(fileSelected(const QString &)),
-            options, SLOT(slotImageFileSelected(const QString &)));
+    options->slotImageFileSelected(fileName);
 
-    options->slotImageFileSelected(m_savingContext->srcURL.path());
-
     // Start dialog and check if canceled.
     if ( imageFileSaveDialog.exec() != KFileDialog::Accepted )
        return false;
@@ -1581,6 +1587,9 @@
         return false;
     }
 
+    config->writeEntry("LastSavedImageTypeMime", m_savingContext->format);
+    config->sync();
+
     // if new and original url are equal use slotSave() ------------------------------
     
     KURL currURL(m_savingContext->srcURL);



More information about the Digikam-devel mailing list