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

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim/libkcal
From:       Bram Schoenmakers <bramschoenmakers () kde ! nl>
Date:       2005-09-02 16:43:45
Message-ID: 1125679425.941935.28738.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 456340 by bram:

When the user specifies an empty URL for the calendar resource, autogenerate one and \
notify the user about that.

BUG:72529



 M  +18 -1     resourcelocalconfig.cpp  


--- branches/KDE/3.5/kdepim/libkcal/resourcelocalconfig.cpp #456339:456340
@@ -26,6 +26,7 @@
 #include <qlayout.h>
 
 #include <klocale.h>
+#include <kmessagebox.h>
 #include <kdebug.h>
 #include <kstandarddirs.h>
 
@@ -78,9 +79,25 @@
 
 void ResourceLocalConfig::saveSettings( KRES::Resource *resource )
 {
+  QString url = mURL->url();
+
+  if( url.isEmpty() ) {
+    KStandardDirs dirs;
+    QString saveFolder = dirs.saveLocation( "data", "korganizer" );
+    QFile file( saveFolder + "/std.ics" );
+    
+    // find a non-existent name
+    for( int i = 0; file.exists(); ++i )
+      file.setName( saveFolder + "/std" + QString::number(i) + ".ics" );
+    
+    KMessageBox::information( this, i18n( "You did not specify a URL for this \
resource. Therefore, the resource will be saved in %1. It is still possible to change \
this location by editing the resource properties." ).arg( file.name() ) ); +    
+    url = file.name();
+  }
+
   ResourceLocal* res = static_cast<ResourceLocal*>( resource );
   if (res) {
-    res->mURL = mURL->url();
+    res->mURL = url;
 
     delete res->mFormat;
     if ( icalButton->isOn() ) {


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

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