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

List:       kde-commits
Subject:    KDE/kdegraphics/okular/ui
From:       Pino Toscano <pino () kde ! org>
Date:       2009-12-26 20:48:03
Message-ID: 1261860483.786974.30341.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1066352 by pino:

activate the overwriting confirmation in all the other file save dialogs


 M  +7 -11     guiutils.cpp  
 M  +2 -1      pageview.cpp  
 M  +8 -11     propertiesdialog.cpp  


--- trunk/KDE/kdegraphics/okular/ui/guiutils.cpp #1066351:1066352
@@ -200,23 +200,19 @@
 void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent )
 {
     const QString caption = i18n( "Where do you want to save %1?", ef->name() );
-    const QString path = KFileDialog::getSaveFileName( ef->name(), QString(), \
parent, caption ); +    const QString path = KFileDialog::getSaveFileName( \
ef->name(), QString(), parent, caption, +                                             \
KFileDialog::ConfirmOverwrite );  if ( path.isEmpty() )
         return;
 
     QFile f( path );
-    if ( !f.exists() || KMessageBox::warningContinueCancel( parent, i18n( "A file \
named \"%1\" already exists. Are you sure you want to overwrite it?", path ), \
QString(), KGuiItem( i18nc( "@action:button", "&Overwrite" ) ) ) == \
KMessageBox::Continue ) +    if ( !f.open( QIODevice::WriteOnly ) )
     {
-        if ( f.open( QIODevice::WriteOnly ) )
-        {
-            f.write( ef->data() );
-            f.close();
-        }
-        else
-        {
-            KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. \
                File was not saved.", path ) );
-        }
+        KMessageBox::error( parent, i18n( "Could not open \"%1\" for writing. File \
was not saved.", path ) ); +        return;
     }
+    f.write( ef->data() );
+    f.close();
 }
 
 }
--- trunk/KDE/kdegraphics/okular/ui/pageview.cpp #1066351:1066352
@@ -2024,7 +2024,8 @@
                 else if ( choice == imageToFile )
                 {
                     // [3] save pixmap to file
-                    QString fileName = KFileDialog::getSaveFileName( KUrl(), \
"image/png image/jpeg", this ); +                    QString fileName = \
KFileDialog::getSaveFileName( KUrl(), "image/png image/jpeg", this, QString(), +      \
KFileDialog::ConfirmOverwrite );  if ( fileName.isEmpty() )
                         d->messageWindow->display( i18n( "File not saved." ), \
PageViewMessage::Warning );  else
--- trunk/KDE/kdegraphics/okular/ui/propertiesdialog.cpp #1066351:1066352
@@ -259,23 +259,20 @@
         {
             Okular::FontInfo fi = \
                index.data(FontInfoRole).value<Okular::FontInfo>();
             const QString caption = i18n( "Where do you want to save %1?", fi.name() \
                );
-            const QString path = KFileDialog::getSaveFileName( fi.name(), QString(), \
this, caption ); +            const QString path = KFileDialog::getSaveFileName( \
fi.name(), QString(), this, caption, KFileDialog::ConfirmOverwrite );  if ( \
path.isEmpty() )  return;
             
             QFile f( path );
-            if ( !f.exists() || KMessageBox::warningContinueCancel( this, i18n( "A \
file named \"%1\" already exists. Are you sure you want to overwrite it?", path ), \
QString(), KGuiItem( i18nc( "@action:button", "&Overwrite" ) ) ) == \
KMessageBox::Continue ) +            if ( f.open( QIODevice::WriteOnly ) )
             {
-                if ( f.open( QIODevice::WriteOnly ) )
-                {
-                    f.write( m_document->fontData(fi) );
-                    f.close();
-                }
-                else
-                {
-                    KMessageBox::error( this, i18n( "Could not open \"%1\" for \
                writing. File was not saved.", path ) );
-                }
+                f.write( m_document->fontData(fi) );
+                f.close();
             }
+            else
+            {
+                KMessageBox::error( this, i18n( "Could not open \"%1\" for writing. \
File was not saved.", path ) ); +            }
         }
     }
 }


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

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