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

List:       kde-commits
Subject:    branches/KDE/4.6/kdebase/runtime/nepomuk/kcm
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2011-01-05 15:01:08
Message-ID: 20110105150108.D9259AC8B1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1212033 by trueg:

Backport: Watch the auto backup folder for changes.

 M  +24 -15    nepomukserverkcm.cpp  
 M  +1 -0      nepomukserverkcm.h  


--- branches/KDE/4.6/kdebase/runtime/nepomuk/kcm/nepomukserverkcm.cpp \
#1212032:1212033 @@ -33,6 +33,7 @@
 #include <KProcess>
 #include <KStandardDirs>
 #include <KCalendarSystem>
+#include <KDirWatch>
 
 #include <Nepomuk/Query/QueryParser>
 #include <Nepomuk/Query/FileQuery>
@@ -216,6 +217,9 @@
         connect( m_buttonRestoreBackup, SIGNAL(clicked(bool)),
                  this, SLOT(slotRestoreBackup()) );
 
+        // update backup status whenever manual backups are created
+        KDirWatch::self()->addDir( KStandardDirs::locateLocal( "data", \
"nepomuk/backupsync/backups/" ) ); +        connect( KDirWatch::self(), \
SIGNAL(dirty(QString)), this, SLOT(updateBackupStatus()) );  }
     else {
         QLabel* label = new QLabel( i18n( "The Nepomuk installation is not complete. \
No Nepomuk settings can be provided." ) ); @@ -286,22 +290,8 @@
     m_spinBackupMax->setValue( backupCfg.readEntry("max backups", 10) );
 
     slotBackupFrequencyChanged();
+    updateBackupStatus();
 
-    QString backupUrl = KStandardDirs::locateLocal( "data", \
                "nepomuk/backupsync/backups/" );
-    QDir dir( backupUrl );
-    QStringList backupFiles = dir.entryList( QDir::Files | QDir::NoDotAndDotDot, \
                QDir::Name );
-
-    QString text = i18np("1 existing backup", "%1 existing backups", \
                backupFiles.size() );
-    if( !backupFiles.isEmpty() ) {
-        text += QLatin1String(" (");
-        text += i18nc("@info %1 is the creation date of a backup formatted vi \
                KLocale::formatDateTime",
-                      "Oldest: %1",
-                      \
KGlobal::locale()->formatDateTime(QFileInfo(backupUrl+QLatin1String("/")+backupFiles.last()).created(), \
                KLocale::FancyShortDate));
-        text += QLatin1String(")");
-    }
-    
-    m_labelBackupStats->setText( text );
-
     // 6. update state
     m_labelIndexFolders->setText( buildFolderLabel( \
                m_indexFolderSelectionDialog->includeFolders(),
                                                     \
m_indexFolderSelectionDialog->excludeFolders() ) ); @@ -435,6 +425,25 @@
 }
 
 
+void Nepomuk::ServerConfigModule::updateBackupStatus()
+{
+    const QString backupUrl = KStandardDirs::locateLocal( "data", \
"nepomuk/backupsync/backups/" ); +    QDir dir( backupUrl );
+    const QStringList backupFiles = dir.entryList( QDir::Files | \
QDir::NoDotAndDotDot, QDir::Name ); +
+    QString text = i18np("1 existing backup", "%1 existing backups", \
backupFiles.size() ); +    if( !backupFiles.isEmpty() ) {
+        text += QLatin1String(" (");
+        text += i18nc("@info %1 is the creation date of a backup formatted vi \
KLocale::formatDateTime", +                      "Oldest: %1",
+                      \
KGlobal::locale()->formatDateTime(QFileInfo(backupUrl+QLatin1String("/")+backupFiles.last()).created(), \
KLocale::FancyShortDate)); +        text += QLatin1String(")");
+    }
+
+    m_labelBackupStats->setText( text );
+}
+
+
 void Nepomuk::ServerConfigModule::recreateInterfaces()
 {
     delete m_strigiInterface;
--- branches/KDE/4.6/kdebase/runtime/nepomuk/kcm/nepomukserverkcm.h #1212032:1212033
@@ -50,6 +50,7 @@
     private Q_SLOTS:
         void updateNepomukServerStatus();
         void updateStrigiStatus();
+        void updateBackupStatus();
         void recreateInterfaces();
         void slotCustomQueryButtonClicked();
         void slotEditIndexFolders();


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

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