summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2004-10-26 22:19:18 (UTC)
committer zautrix <zautrix>2004-10-26 22:19:18 (UTC)
commit6385f303bef3cbcd19d097a7b05c30e144d5dd6e (patch) (side-by-side diff)
tree770795d94ea6ec1dc8bcaa67cc174a9c0add564a /libkdepim
parent13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (diff)
downloadkdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.zip
kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.gz
kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.bz2
implemented remove sync info for kopi and kapi
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp42
-rw-r--r--libkdepim/ksyncmanager.h1
2 files changed, 41 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 4390a06..feb184b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -87,6 +87,12 @@ void KSyncManager::fillSyncMenu()
mSyncMenu->insertItem( i18n("Configure..."), 0 );
mSyncMenu->insertSeparator();
+ QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
+ mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
+ clearMenu->insertItem( i18n("For all profiles"), 1 );
+ clearMenu->insertSeparator();
+ connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
+ mSyncMenu->insertSeparator();
if ( mServerSocket == 0 ) {
mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
} else {
@@ -95,7 +101,6 @@ void KSyncManager::fillSyncMenu()
mSyncMenu->insertSeparator();
mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
mSyncMenu->insertSeparator();
-
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
config.setGroup("General");
QStringList prof = config.readListEntry("SyncProfileNames");
@@ -132,7 +137,8 @@ void KSyncManager::fillSyncMenu()
mSyncProfileNames = prof;
unsigned int i;
for ( i = 0; i < prof.count(); ++i ) {
- mSyncMenu->insertItem( prof[i], 1000+i );
+ mSyncMenu->insertItem( prof[i], 1000+i );
+ clearMenu->insertItem( prof[i], 1000+i );
if ( i == 2 )
mSyncMenu->insertSeparator();
}
@@ -140,18 +146,44 @@ void KSyncManager::fillSyncMenu()
//US do not display SharpDTM if app is pwmpi, or no sharpfiles available
if ( mTargetApp == PWMPI) {
mSyncMenu->removeItem( 1000 );
+ clearMenu->removeItem( 1000 );
}
#ifndef DESKTOP_VERSION
else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
mSyncMenu->removeItem( 1000 );
+ clearMenu->removeItem( 1000 );
}
#endif
mSyncMenu->removeItem( 1002 );
+ clearMenu->removeItem( 1002 );
}
+void KSyncManager::slotClearMenu( int action )
+{
+ QString syncDevice;
+ if ( action > 999 ) {
+ syncDevice = mSyncProfileNames[action - 1000] ;
+ }
+
+
+ int result = 0;
+ QString sd;
+ if ( syncDevice.isEmpty() )
+ sd = i18n("Do you want to\nclear all sync info\nof all profiles?");
+ else
+ sd = i18n("Do you want to\nclear the sync\ninfo of profile\n%1?\n"). arg( syncDevice );
+
+ result = QMessageBox::warning( mParent, i18n("Warning!"),sd,i18n("OK"), i18n("Cancel"), 0,
+ 0, 1 );
+ if ( result )
+ return;
+ mImplementation->removeSyncInfo( syncDevice );
+}
void KSyncManager::slotSyncMenu( int action )
{
qDebug("syncaction %d ", action);
+ if ( action == 5000 )
+ return;
if ( action == 0 ) {
// seems to be a Qt2 event handling bug
@@ -835,8 +867,14 @@ void KSyncManager::confSync()
sp->show();
#endif
sp->exec();
+ QStringList oldSyncProfileNames = mSyncProfileNames;
mSyncProfileNames = sp->getSyncProfileNames();
mLocalMachineName = sp->getLocalMachineName ();
+ int ii;
+ for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) {
+ if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) )
+ mImplementation->removeSyncInfo( oldSyncProfileNames[ii] );
+ }
QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
}
void KSyncManager::syncKDE()
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index af4f1ab..aa32e28 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -154,6 +154,7 @@ class KSyncManager : public QObject
public slots:
void slotSyncMenu( int );
+ void slotClearMenu( int action );
void deleteCommandSocket(KCommandSocket*s, int state);
void readFileFromSocket();
void fillSyncMenu();