summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 554c6e5..4390a06 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -57,117 +57,119 @@
57 57
58KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 58KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
59 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) 59 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
60{ 60{
61 mServerSocket = 0; 61 mServerSocket = 0;
62 bar = new QProgressBar ( 1, 0 ); 62 bar = new QProgressBar ( 1, 0 );
63 bar->setCaption (""); 63 bar->setCaption ("");
64 64
65 int w = 300; 65 int w = 300;
66 if ( QApplication::desktop()->width() < 320 ) 66 if ( QApplication::desktop()->width() < 320 )
67 w = 220; 67 w = 220;
68 int h = bar->sizeHint().height() ; 68 int h = bar->sizeHint().height() ;
69 int dw = QApplication::desktop()->width(); 69 int dw = QApplication::desktop()->width();
70 int dh = QApplication::desktop()->height(); 70 int dh = QApplication::desktop()->height();
71 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 71 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
72 if ( mPrefs->mPassiveSyncAutoStart ) 72 if ( mPrefs->mPassiveSyncAutoStart )
73 enableQuick( false ); 73 enableQuick( false );
74 74
75} 75}
76 76
77KSyncManager::~KSyncManager() 77KSyncManager::~KSyncManager()
78{ 78{
79 delete bar; 79 delete bar;
80} 80}
81 81
82 82
83void KSyncManager::fillSyncMenu() 83void KSyncManager::fillSyncMenu()
84{ 84{
85 if ( mSyncMenu->count() ) 85 if ( mSyncMenu->count() )
86 mSyncMenu->clear(); 86 mSyncMenu->clear();
87 87
88 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 88 mSyncMenu->insertItem( i18n("Configure..."), 0 );
89 mSyncMenu->insertSeparator(); 89 mSyncMenu->insertSeparator();
90 if ( mServerSocket == 0 ) { 90 if ( mServerSocket == 0 ) {
91 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); 91 mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 );
92 } else { 92 } else {
93 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); 93 mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 );
94 } 94 }
95 mSyncMenu->insertSeparator(); 95 mSyncMenu->insertSeparator();
96 mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); 96 mSyncMenu->insertItem( i18n("Multiple sync"), 1 );
97 mSyncMenu->insertSeparator(); 97 mSyncMenu->insertSeparator();
98 98
99 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 99 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
100 config.setGroup("General"); 100 config.setGroup("General");
101 QStringList prof = config.readListEntry("SyncProfileNames"); 101 QStringList prof = config.readListEntry("SyncProfileNames");
102 mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 102 mLocalMachineName = config.readEntry("LocalMachineName","undefined");
103 if ( prof.count() < 2 ) { 103 if ( prof.count() < 2 ) {
104 prof.clear(); 104 prof.clear();
105 QString externalName;
105#ifdef DESKTOP_VERSION 106#ifdef DESKTOP_VERSION
106#ifdef _WIN32_ 107#ifdef _WIN32_
107 prof << i18n("OutLook(not_implemented)"); 108 externalName = "OutLook(not_implemented)";
108#else 109#else
109 prof << i18n("KDE_Desktop"); 110 externalName = "KDE_Desktop";
110#endif 111#endif
111#else 112#else
112 prof << i18n("Sharp_DTM"); 113 externalName = "Sharp_DTM";
113#endif 114#endif
115 prof << externalName;
114 prof << i18n("Local_file"); 116 prof << i18n("Local_file");
115 prof << i18n("Last_file"); 117 prof << i18n("Last_file");
116 KSyncProfile* temp = new KSyncProfile (); 118 KSyncProfile* temp = new KSyncProfile ();
117 temp->setName( prof[0] ); 119 temp->setName( prof[0] );
118 temp->writeConfig(&config); 120 temp->writeConfig(&config);
119 temp->setName( prof[1] ); 121 temp->setName( prof[1] );
120 temp->writeConfig(&config); 122 temp->writeConfig(&config);
121 temp->setName( prof[2] ); 123 temp->setName( prof[2] );
122 temp->writeConfig(&config); 124 temp->writeConfig(&config);
123 config.setGroup("General"); 125 config.setGroup("General");
124 config.writeEntry("SyncProfileNames",prof); 126 config.writeEntry("SyncProfileNames",prof);
125 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 127 config.writeEntry("ExternSyncProfiles",externalName);
126 config.sync(); 128 config.sync();
127 delete temp; 129 delete temp;
128 } 130 }
129 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 131 mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
130 mSyncProfileNames = prof; 132 mSyncProfileNames = prof;
131 unsigned int i; 133 unsigned int i;
132 for ( i = 0; i < prof.count(); ++i ) { 134 for ( i = 0; i < prof.count(); ++i ) {
133 mSyncMenu->insertItem( prof[i], 1000+i ); 135 mSyncMenu->insertItem( prof[i], 1000+i );
134 if ( i == 2 ) 136 if ( i == 2 )
135 mSyncMenu->insertSeparator(); 137 mSyncMenu->insertSeparator();
136 } 138 }
137 QDir app_dir; 139 QDir app_dir;
138 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available 140 //US do not display SharpDTM if app is pwmpi, or no sharpfiles available
139 if ( mTargetApp == PWMPI) { 141 if ( mTargetApp == PWMPI) {
140 mSyncMenu->removeItem( 1000 ); 142 mSyncMenu->removeItem( 1000 );
141 } 143 }
142#ifndef DESKTOP_VERSION 144#ifndef DESKTOP_VERSION
143 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 145 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
144 mSyncMenu->removeItem( 1000 ); 146 mSyncMenu->removeItem( 1000 );
145 } 147 }
146#endif 148#endif
147 mSyncMenu->removeItem( 1002 ); 149 mSyncMenu->removeItem( 1002 );
148} 150}
149 151
150void KSyncManager::slotSyncMenu( int action ) 152void KSyncManager::slotSyncMenu( int action )
151{ 153{
152 qDebug("syncaction %d ", action); 154 qDebug("syncaction %d ", action);
153 if ( action == 0 ) { 155 if ( action == 0 ) {
154 156
155 // seems to be a Qt2 event handling bug 157 // seems to be a Qt2 event handling bug
156 // syncmenu.clear causes a segfault at first time 158 // syncmenu.clear causes a segfault at first time
157 // when we call it after the main event loop, it is ok 159 // when we call it after the main event loop, it is ok
158 // same behaviour when calling OM/Pi via QCOP for the first time 160 // same behaviour when calling OM/Pi via QCOP for the first time
159 QTimer::singleShot ( 1, this, SLOT ( confSync() ) ); 161 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
160 //confSync(); 162 //confSync();
161 163
162 return; 164 return;
163 } 165 }
164 if ( action == 1 ) { 166 if ( action == 1 ) {
165 multiSync( true ); 167 multiSync( true );
166 return; 168 return;
167 } 169 }
168 if ( action == 2 ) { 170 if ( action == 2 ) {
169 enableQuick(); 171 enableQuick();
170 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 172 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
171 return; 173 return;
172 } 174 }
173 if ( action == 3 ) { 175 if ( action == 3 ) {