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

List:       kde-commits
Subject:    KDE/kdepim/kjots
From:       Laurent Montel <montel () kde ! org>
Date:       2008-07-07 7:08:00
Message-ID: 1215414480.009420.9601.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 828989 by mlaurent:

Don't crash when we canceled export file


 M  +6 -8      kjotscomponent.cpp  


--- trunk/KDE/kdepim/kjots/kjotscomponent.cpp #828988:828989
@@ -998,18 +998,15 @@
 
 void KJotsComponent::saveToFile(KJotsComponent::ExportType type)
 {
-    autoSave();
-
+  autoSave();
     QString title;
     QList<KJotsEntry*> entries = bookshelf->selected();
     Q_ASSERT(entries.size());
-
     if ( entries.size() == 1 ) {
         title = entries[0]->title();
     } else {
         title = i18n("Multiple Selections");
     }
-
     KUrl saveUrl;
     QString encoding;
     if ( type == Native ) {
@@ -1019,15 +1016,18 @@
         KEncodingFileDialog::Result res;
         res = KEncodingFileDialog::getSaveUrlAndEncoding(
             QString("UTF-8"), title + ".html", "*.html|" + i18n("HTML Files"));
+        if ( res.URLs.isEmpty() )
+          return;
         saveUrl = res.URLs[0];
         encoding = res.encoding;
     } else if ( type == Ascii ) {
         KEncodingFileDialog::Result res;
         res = KEncodingFileDialog::getSaveUrlAndEncoding(QString("UTF-8"), title);
+        if ( res.URLs.isEmpty() )
+          return;
         saveUrl = res.URLs[0];
         encoding = res.encoding;
     }
-
     //Create an interim file for us to write to
     std::auto_ptr<KTemporaryFile> interimFile ( new KTemporaryFile );
     interimFile->setAutoRemove(false);
@@ -1108,8 +1108,6 @@
         KJob *job = KIO::move(tempUrl, saveUrl);
         connect( job, SIGNAL( result(KJob*) ), this, SLOT( saveFinished(KJob*) ) );
     }
-
-    return;
 }
 
 void KJotsComponent::saveFinished(KJob *job)
@@ -1292,7 +1290,7 @@
             action->setEnabled(false);
         foreach ( QAction* action, multiselectionActions )
             action->setEnabled(true);
-    
+
         editor->setActionsEnabled( false );
     } else {
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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