[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/graphics/digikam/utilities/imageeditor/editor
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2008-01-04 15:16:28
Message-ID: 1199459788.002940.3804.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 757249 by cgilles:

backport commit #757242 from KDE3 branch


 M  +17 -7     editorwindow.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/editor/editorwindow.cpp #757248:757249
@@ -1414,7 +1414,8 @@
     // inspired by kimageio.cpp, typeForMime(). This here is "mimeForType".
     KService::List services = KServiceTypeTrader::self()->query("QImageIOPlugins");
     KService::Ptr service;
-    foreach(service, services) {
+    foreach(service, services) 
+    {
         if (service->property("X-KDE-ImageFormat").toStringList().contains(originalFormat))
         {
             defaultMimeType = service->property("X-KDE-MimeType").toString();
@@ -1434,19 +1435,25 @@
                                     this,
                                     options);
 
+    connect(&imageFileSaveDialog, SIGNAL(filterChanged(const QString &)),
+            options, SLOT(slotImageFileFormatChanged(const QString &)));
+
+    connect(&imageFileSaveDialog, SIGNAL(fileSelected(const QString &)),
+            options, SLOT(slotImageFileSelected(const QString &)));
+
     imageFileSaveDialog.setModal(false);
     imageFileSaveDialog.setOperationMode(KFileDialog::Saving);
     imageFileSaveDialog.setMode(KFile::File);
-    imageFileSaveDialog.setSelection(m_savingContext->srcURL.fileName());
     imageFileSaveDialog.setCaption(i18n("New Image File Name"));
     imageFileSaveDialog.setMimeFilter(writableMimetypes, defaultMimeType);
 
-    connect(&imageFileSaveDialog, SIGNAL(filterChanged(const QString &)),
-            options, SLOT(slotImageFileFormatChanged(const QString &)));
+    QFileInfo info(m_savingContext->srcURL.fileName());
+    KSharedConfig::Ptr config = KGlobal::config();
+    KConfigGroup group        = config->group("ImageViewer Settings");
+    QString ext               = group.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(m_savingContext->srcURL.path());
 
     // Start dialog and check if canceled.
@@ -1506,6 +1513,9 @@
         return false;
     }
 
+    group.writeEntry("LastSavedImageTypeMime", m_savingContext->format);
+    config->sync();
+
     // if new and original url are equal use slotSave() ------------------------------
 
     KUrl currURL(m_savingContext->srcURL);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic