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

List:       kde-commits
Subject:    KDE/kdepim/ktimetracker
From:       Laurent Montel <montel () kde ! org>
Date:       2008-02-01 15:11:45
Message-ID: 1201878705.716276.3750.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 769487 by mlaurent:

Make migration.
if ktimertracker dir is empty we didn't launch it
look at if karm/karm.ics exists
=> use it 
otherwise create default file.
Now I can have my history.
(I will backport it if it's correct)


 M  +16 -6     main.cpp  


--- trunk/KDE/kdepim/ktimetracker/main.cpp #769486:769487
@@ -21,7 +21,7 @@
  */
 
 #include <signal.h>
-
+#include <QFile>
 #include <KAboutData>
 #include <KCmdLineArgs>
 #include <KDebug>
@@ -31,8 +31,8 @@
 
 #include "version.h"
 #include "mainwindow.h"
+#include <QDebug>
 
-
 namespace
 {
   const char* description = I18N_NOOP("KDE Time tracker tool");
@@ -71,10 +71,10 @@
   KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
   MainWindow *mainWindow;
-  if ( args->count() > 0 ) 
+  if ( args->count() > 0 )
   {
     QString icsfile = args->arg( 0 );
-    
+
     KUrl* icsfileurl=new KUrl(args->arg( 0 ));
     if (( icsfileurl->protocol() == "http" ) || ( icsfileurl->protocol() == "ftp" ) \
|| ( icsfileurl->isLocalFile() ))  {
@@ -90,8 +90,18 @@
   }
   else
   {
-    mainWindow = new MainWindow( KStandardDirs::locateLocal( "appdata", 
-                                 QString::fromLatin1( "karm.ics" ) ) );
+    KStandardDirs tmp;
+    tmp.localkdedir();
+    QString newKarmFile(tmp.localkdedir() + "/share/apps/ktimetracker/karm.ics" );
+    if ( !QFile::exists( newKarmFile ) )
+    {
+      QFile oldFile( tmp.localkdedir() + "/share/apps/karm/karm.ics" );
+      if ( oldFile.exists() )
+        oldFile.copy( newKarmFile );
+      else
+        newKarmFile = KStandardDirs::locateLocal( "appdata", QString::fromLatin1( \
"karm.ics" ) ); +    }
+    mainWindow = new MainWindow( newKarmFile );
   }
 
   if (kapp->isSessionRestored() && KMainWindow::canBeRestored( 1 ))


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

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