-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index c4382d6..4c1d5da 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1078,1537 +1078,1537 @@ void KABCore::newContact() | |||
1078 | 1078 | ||
1079 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1079 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1080 | resource = static_cast<KABC::Resource*>( res ); | 1080 | resource = static_cast<KABC::Resource*>( res ); |
1081 | 1081 | ||
1082 | if ( resource ) { | 1082 | if ( resource ) { |
1083 | KABC::Addressee addr; | 1083 | KABC::Addressee addr; |
1084 | addr.setResource( resource ); | 1084 | addr.setResource( resource ); |
1085 | mEditorDialog->setAddressee( addr ); | 1085 | mEditorDialog->setAddressee( addr ); |
1086 | KApplication::execDialog ( mEditorDialog ); | 1086 | KApplication::execDialog ( mEditorDialog ); |
1087 | 1087 | ||
1088 | } else | 1088 | } else |
1089 | return; | 1089 | return; |
1090 | 1090 | ||
1091 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1091 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1092 | 1092 | ||
1093 | 1093 | ||
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | void KABCore::addEmail( QString aStr ) | 1096 | void KABCore::addEmail( QString aStr ) |
1097 | { | 1097 | { |
1098 | #ifndef KAB_EMBEDDED | 1098 | #ifndef KAB_EMBEDDED |
1099 | QString fullName, email; | 1099 | QString fullName, email; |
1100 | 1100 | ||
1101 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1101 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1102 | 1102 | ||
1103 | // Try to lookup the addressee matching the email address | 1103 | // Try to lookup the addressee matching the email address |
1104 | bool found = false; | 1104 | bool found = false; |
1105 | QStringList emailList; | 1105 | QStringList emailList; |
1106 | KABC::AddressBook::Iterator it; | 1106 | KABC::AddressBook::Iterator it; |
1107 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1107 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1108 | emailList = (*it).emails(); | 1108 | emailList = (*it).emails(); |
1109 | if ( emailList.contains( email ) > 0 ) { | 1109 | if ( emailList.contains( email ) > 0 ) { |
1110 | found = true; | 1110 | found = true; |
1111 | (*it).setNameFromString( fullName ); | 1111 | (*it).setNameFromString( fullName ); |
1112 | editContact( (*it).uid() ); | 1112 | editContact( (*it).uid() ); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | if ( !found ) { | 1116 | if ( !found ) { |
1117 | KABC::Addressee addr; | 1117 | KABC::Addressee addr; |
1118 | addr.setNameFromString( fullName ); | 1118 | addr.setNameFromString( fullName ); |
1119 | addr.insertEmail( email, true ); | 1119 | addr.insertEmail( email, true ); |
1120 | 1120 | ||
1121 | mAddressBook->insertAddressee( addr ); | 1121 | mAddressBook->insertAddressee( addr ); |
1122 | mViewManager->refreshView( addr.uid() ); | 1122 | mViewManager->refreshView( addr.uid() ); |
1123 | editContact( addr.uid() ); | 1123 | editContact( addr.uid() ); |
1124 | } | 1124 | } |
1125 | #else //KAB_EMBEDDED | 1125 | #else //KAB_EMBEDDED |
1126 | qDebug("KABCore::addEmail finsih method"); | 1126 | qDebug("KABCore::addEmail finsih method"); |
1127 | #endif //KAB_EMBEDDED | 1127 | #endif //KAB_EMBEDDED |
1128 | } | 1128 | } |
1129 | 1129 | ||
1130 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1130 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1131 | { | 1131 | { |
1132 | mXXPortManager->importVCard( url, showPreview ); | 1132 | mXXPortManager->importVCard( url, showPreview ); |
1133 | } | 1133 | } |
1134 | void KABCore::importFromOL() | 1134 | void KABCore::importFromOL() |
1135 | { | 1135 | { |
1136 | #ifdef _WIN32_ | 1136 | #ifdef _WIN32_ |
1137 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1137 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1138 | idgl->exec(); | 1138 | idgl->exec(); |
1139 | KABC::Addressee::List list = idgl->getAddressList(); | 1139 | KABC::Addressee::List list = idgl->getAddressList(); |
1140 | if ( list.count() > 0 ) { | 1140 | if ( list.count() > 0 ) { |
1141 | KABC::Addressee::List listNew; | 1141 | KABC::Addressee::List listNew; |
1142 | KABC::Addressee::List listExisting; | 1142 | KABC::Addressee::List listExisting; |
1143 | KABC::Addressee::List::Iterator it; | 1143 | KABC::Addressee::List::Iterator it; |
1144 | KABC::AddressBook::Iterator iter; | 1144 | KABC::AddressBook::Iterator iter; |
1145 | for ( it = list.begin(); it != list.end(); ++it ) { | 1145 | for ( it = list.begin(); it != list.end(); ++it ) { |
1146 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1146 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1147 | listNew.append( (*it) ); | 1147 | listNew.append( (*it) ); |
1148 | else | 1148 | else |
1149 | listExisting.append( (*it) ); | 1149 | listExisting.append( (*it) ); |
1150 | } | 1150 | } |
1151 | if ( listExisting.count() > 0 ) | 1151 | if ( listExisting.count() > 0 ) |
1152 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1152 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1153 | if ( listNew.count() > 0 ) { | 1153 | if ( listNew.count() > 0 ) { |
1154 | pasteWithNewUid = false; | 1154 | pasteWithNewUid = false; |
1155 | pasteContacts( listNew ); | 1155 | pasteContacts( listNew ); |
1156 | pasteWithNewUid = true; | 1156 | pasteWithNewUid = true; |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
1159 | delete idgl; | 1159 | delete idgl; |
1160 | #endif | 1160 | #endif |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1163 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1164 | { | 1164 | { |
1165 | mXXPortManager->importVCard( vCard, showPreview ); | 1165 | mXXPortManager->importVCard( vCard, showPreview ); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | //US added a second method without defaultparameter | 1168 | //US added a second method without defaultparameter |
1169 | void KABCore::editContact2() { | 1169 | void KABCore::editContact2() { |
1170 | editContact( QString::null ); | 1170 | editContact( QString::null ); |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | void KABCore::editContact( const QString &uid ) | 1173 | void KABCore::editContact( const QString &uid ) |
1174 | { | 1174 | { |
1175 | 1175 | ||
1176 | if ( mExtensionManager->isQuickEditVisible() ) | 1176 | if ( mExtensionManager->isQuickEditVisible() ) |
1177 | return; | 1177 | return; |
1178 | 1178 | ||
1179 | // First, locate the contact entry | 1179 | // First, locate the contact entry |
1180 | QString localUID = uid; | 1180 | QString localUID = uid; |
1181 | if ( localUID.isNull() ) { | 1181 | if ( localUID.isNull() ) { |
1182 | QStringList uidList = mViewManager->selectedUids(); | 1182 | QStringList uidList = mViewManager->selectedUids(); |
1183 | if ( uidList.count() > 0 ) | 1183 | if ( uidList.count() > 0 ) |
1184 | localUID = *( uidList.at( 0 ) ); | 1184 | localUID = *( uidList.at( 0 ) ); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1187 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1188 | if ( !addr.isEmpty() ) { | 1188 | if ( !addr.isEmpty() ) { |
1189 | mEditorDialog->setAddressee( addr ); | 1189 | mEditorDialog->setAddressee( addr ); |
1190 | KApplication::execDialog ( mEditorDialog ); | 1190 | KApplication::execDialog ( mEditorDialog ); |
1191 | } | 1191 | } |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | /** | 1194 | /** |
1195 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1195 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1196 | the method will try to find a selected addressee in the view. | 1196 | the method will try to find a selected addressee in the view. |
1197 | */ | 1197 | */ |
1198 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1198 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1199 | { | 1199 | { |
1200 | if ( mMultipleViewsAtOnce ) | 1200 | if ( mMultipleViewsAtOnce ) |
1201 | { | 1201 | { |
1202 | editContact( uid ); | 1202 | editContact( uid ); |
1203 | } | 1203 | } |
1204 | else | 1204 | else |
1205 | { | 1205 | { |
1206 | setDetailsVisible( true ); | 1206 | setDetailsVisible( true ); |
1207 | mActionDetails->setChecked(true); | 1207 | mActionDetails->setChecked(true); |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | void KABCore::save() | 1212 | void KABCore::save() |
1213 | { | 1213 | { |
1214 | if (syncManager->blockSave()) | 1214 | if (syncManager->blockSave()) |
1215 | return; | 1215 | return; |
1216 | if ( !mModified ) | 1216 | if ( !mModified ) |
1217 | return; | 1217 | return; |
1218 | 1218 | ||
1219 | syncManager->setBlockSave(true); | 1219 | syncManager->setBlockSave(true); |
1220 | QString text = i18n( "There was an error while attempting to save\n the " | 1220 | QString text = i18n( "There was an error while attempting to save\n the " |
1221 | "address book. Please check that some \nother application is " | 1221 | "address book. Please check that some \nother application is " |
1222 | "not using it. " ); | 1222 | "not using it. " ); |
1223 | message(i18n("Saving addressbook ... ")); | 1223 | message(i18n("Saving addressbook ... ")); |
1224 | #ifndef KAB_EMBEDDED | 1224 | #ifndef KAB_EMBEDDED |
1225 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1225 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1226 | if ( !b || !b->save() ) { | 1226 | if ( !b || !b->save() ) { |
1227 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1227 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1228 | } | 1228 | } |
1229 | #else //KAB_EMBEDDED | 1229 | #else //KAB_EMBEDDED |
1230 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1230 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1231 | if ( !b || !b->save() ) { | 1231 | if ( !b || !b->save() ) { |
1232 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1232 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1233 | } | 1233 | } |
1234 | #endif //KAB_EMBEDDED | 1234 | #endif //KAB_EMBEDDED |
1235 | 1235 | ||
1236 | message(i18n("Addressbook saved!")); | 1236 | message(i18n("Addressbook saved!")); |
1237 | setModified( false ); | 1237 | setModified( false ); |
1238 | syncManager->setBlockSave(false); | 1238 | syncManager->setBlockSave(false); |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | 1241 | ||
1242 | void KABCore::undo() | 1242 | void KABCore::undo() |
1243 | { | 1243 | { |
1244 | UndoStack::instance()->undo(); | 1244 | UndoStack::instance()->undo(); |
1245 | 1245 | ||
1246 | // Refresh the view | 1246 | // Refresh the view |
1247 | mViewManager->refreshView(); | 1247 | mViewManager->refreshView(); |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | void KABCore::redo() | 1250 | void KABCore::redo() |
1251 | { | 1251 | { |
1252 | RedoStack::instance()->redo(); | 1252 | RedoStack::instance()->redo(); |
1253 | 1253 | ||
1254 | // Refresh the view | 1254 | // Refresh the view |
1255 | mViewManager->refreshView(); | 1255 | mViewManager->refreshView(); |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1258 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1259 | { | 1259 | { |
1260 | if (mMultipleViewsAtOnce) | 1260 | if (mMultipleViewsAtOnce) |
1261 | { | 1261 | { |
1262 | if ( visible ) | 1262 | if ( visible ) |
1263 | mJumpButtonBar->show(); | 1263 | mJumpButtonBar->show(); |
1264 | else | 1264 | else |
1265 | mJumpButtonBar->hide(); | 1265 | mJumpButtonBar->hide(); |
1266 | } | 1266 | } |
1267 | else | 1267 | else |
1268 | { | 1268 | { |
1269 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1269 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1270 | if (mViewManager->isVisible()) | 1270 | if (mViewManager->isVisible()) |
1271 | { | 1271 | { |
1272 | if ( visible ) | 1272 | if ( visible ) |
1273 | mJumpButtonBar->show(); | 1273 | mJumpButtonBar->show(); |
1274 | else | 1274 | else |
1275 | mJumpButtonBar->hide(); | 1275 | mJumpButtonBar->hide(); |
1276 | } | 1276 | } |
1277 | else | 1277 | else |
1278 | { | 1278 | { |
1279 | mJumpButtonBar->hide(); | 1279 | mJumpButtonBar->hide(); |
1280 | } | 1280 | } |
1281 | } | 1281 | } |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | 1284 | ||
1285 | void KABCore::setDetailsToState() | 1285 | void KABCore::setDetailsToState() |
1286 | { | 1286 | { |
1287 | setDetailsVisible( mActionDetails->isChecked() ); | 1287 | setDetailsVisible( mActionDetails->isChecked() ); |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | 1290 | ||
1291 | 1291 | ||
1292 | void KABCore::setDetailsVisible( bool visible ) | 1292 | void KABCore::setDetailsVisible( bool visible ) |
1293 | { | 1293 | { |
1294 | if (visible && mDetails->isHidden()) | 1294 | if (visible && mDetails->isHidden()) |
1295 | { | 1295 | { |
1296 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1296 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1297 | if ( addrList.count() > 0 ) | 1297 | if ( addrList.count() > 0 ) |
1298 | mDetails->setAddressee( addrList[ 0 ] ); | 1298 | mDetails->setAddressee( addrList[ 0 ] ); |
1299 | } | 1299 | } |
1300 | 1300 | ||
1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1301 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1302 | // the listview and the detailview. We do that by changing the splitbar size. | 1302 | // the listview and the detailview. We do that by changing the splitbar size. |
1303 | if (mMultipleViewsAtOnce) | 1303 | if (mMultipleViewsAtOnce) |
1304 | { | 1304 | { |
1305 | if ( visible ) | 1305 | if ( visible ) |
1306 | mDetails->show(); | 1306 | mDetails->show(); |
1307 | else | 1307 | else |
1308 | mDetails->hide(); | 1308 | mDetails->hide(); |
1309 | } | 1309 | } |
1310 | else | 1310 | else |
1311 | { | 1311 | { |
1312 | if ( visible ) { | 1312 | if ( visible ) { |
1313 | mViewManager->hide(); | 1313 | mViewManager->hide(); |
1314 | mDetails->show(); | 1314 | mDetails->show(); |
1315 | } | 1315 | } |
1316 | else { | 1316 | else { |
1317 | mViewManager->show(); | 1317 | mViewManager->show(); |
1318 | mDetails->hide(); | 1318 | mDetails->hide(); |
1319 | } | 1319 | } |
1320 | setJumpButtonBarVisible( !visible ); | 1320 | setJumpButtonBarVisible( !visible ); |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | void KABCore::extensionChanged( int id ) | 1325 | void KABCore::extensionChanged( int id ) |
1326 | { | 1326 | { |
1327 | //change the details view only for non desktop systems | 1327 | //change the details view only for non desktop systems |
1328 | #ifndef DESKTOP_VERSION | 1328 | #ifndef DESKTOP_VERSION |
1329 | 1329 | ||
1330 | if (id == 0) | 1330 | if (id == 0) |
1331 | { | 1331 | { |
1332 | //the user disabled the extension. | 1332 | //the user disabled the extension. |
1333 | 1333 | ||
1334 | if (mMultipleViewsAtOnce) | 1334 | if (mMultipleViewsAtOnce) |
1335 | { // enable detailsview again | 1335 | { // enable detailsview again |
1336 | setDetailsVisible( true ); | 1336 | setDetailsVisible( true ); |
1337 | mActionDetails->setChecked( true ); | 1337 | mActionDetails->setChecked( true ); |
1338 | } | 1338 | } |
1339 | else | 1339 | else |
1340 | { //go back to the listview | 1340 | { //go back to the listview |
1341 | setDetailsVisible( false ); | 1341 | setDetailsVisible( false ); |
1342 | mActionDetails->setChecked( false ); | 1342 | mActionDetails->setChecked( false ); |
1343 | mActionDetails->setEnabled(true); | 1343 | mActionDetails->setEnabled(true); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | } | 1346 | } |
1347 | else | 1347 | else |
1348 | { | 1348 | { |
1349 | //the user enabled the extension. | 1349 | //the user enabled the extension. |
1350 | setDetailsVisible( false ); | 1350 | setDetailsVisible( false ); |
1351 | mActionDetails->setChecked( false ); | 1351 | mActionDetails->setChecked( false ); |
1352 | 1352 | ||
1353 | if (!mMultipleViewsAtOnce) | 1353 | if (!mMultipleViewsAtOnce) |
1354 | { | 1354 | { |
1355 | mActionDetails->setEnabled(false); | 1355 | mActionDetails->setEnabled(false); |
1356 | } | 1356 | } |
1357 | 1357 | ||
1358 | mExtensionManager->setSelectionChanged(); | 1358 | mExtensionManager->setSelectionChanged(); |
1359 | 1359 | ||
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | #endif// DESKTOP_VERSION | 1362 | #endif// DESKTOP_VERSION |
1363 | 1363 | ||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | 1366 | ||
1367 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1367 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1368 | { | 1368 | { |
1369 | 1369 | ||
1370 | if ( list.count() != 0 ) { | 1370 | if ( list.count() != 0 ) { |
1371 | KABC::Addressee::List::ConstIterator it; | 1371 | KABC::Addressee::List::ConstIterator it; |
1372 | for ( it = list.begin(); it != list.end(); ++it ) | 1372 | for ( it = list.begin(); it != list.end(); ++it ) |
1373 | mAddressBook->insertAddressee( *it ); | 1373 | mAddressBook->insertAddressee( *it ); |
1374 | if ( list.count() > 1 ) | 1374 | if ( list.count() > 1 ) |
1375 | setModified(); | 1375 | setModified(); |
1376 | else | 1376 | else |
1377 | setModifiedWOrefresh(); | 1377 | setModifiedWOrefresh(); |
1378 | } | 1378 | } |
1379 | if ( list.count() == 0 ) | 1379 | if ( list.count() == 0 ) |
1380 | mViewManager->refreshView(); | 1380 | mViewManager->refreshView(); |
1381 | else | 1381 | else |
1382 | mViewManager->refreshView( list[ 0 ].uid() ); | 1382 | mViewManager->refreshView( list[ 0 ].uid() ); |
1383 | 1383 | ||
1384 | 1384 | ||
1385 | 1385 | ||
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | QString KABCore::getNameByPhone( const QString &phone ) | 1388 | QString KABCore::getNameByPhone( const QString &phone ) |
1389 | { | 1389 | { |
1390 | #ifndef KAB_EMBEDDED | 1390 | #ifndef KAB_EMBEDDED |
1391 | QRegExp r( "[/*/-/ ]" ); | 1391 | QRegExp r( "[/*/-/ ]" ); |
1392 | QString localPhone( phone ); | 1392 | QString localPhone( phone ); |
1393 | 1393 | ||
1394 | bool found = false; | 1394 | bool found = false; |
1395 | QString ownerName = ""; | 1395 | QString ownerName = ""; |
1396 | KABC::AddressBook::Iterator iter; | 1396 | KABC::AddressBook::Iterator iter; |
1397 | KABC::PhoneNumber::List::Iterator phoneIter; | 1397 | KABC::PhoneNumber::List::Iterator phoneIter; |
1398 | KABC::PhoneNumber::List phoneList; | 1398 | KABC::PhoneNumber::List phoneList; |
1399 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1399 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1400 | phoneList = (*iter).phoneNumbers(); | 1400 | phoneList = (*iter).phoneNumbers(); |
1401 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1401 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1402 | ++phoneIter) { | 1402 | ++phoneIter) { |
1403 | // Get rid of separator chars so just the numbers are compared. | 1403 | // Get rid of separator chars so just the numbers are compared. |
1404 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1404 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1405 | ownerName = (*iter).formattedName(); | 1405 | ownerName = (*iter).formattedName(); |
1406 | found = true; | 1406 | found = true; |
1407 | } | 1407 | } |
1408 | } | 1408 | } |
1409 | } | 1409 | } |
1410 | 1410 | ||
1411 | return ownerName; | 1411 | return ownerName; |
1412 | #else //KAB_EMBEDDED | 1412 | #else //KAB_EMBEDDED |
1413 | qDebug("KABCore::getNameByPhone finsih method"); | 1413 | qDebug("KABCore::getNameByPhone finsih method"); |
1414 | return ""; | 1414 | return ""; |
1415 | #endif //KAB_EMBEDDED | 1415 | #endif //KAB_EMBEDDED |
1416 | 1416 | ||
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | void KABCore::openConfigDialog() | 1419 | void KABCore::openConfigDialog() |
1420 | { | 1420 | { |
1421 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1421 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1422 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1422 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1423 | ConfigureDialog->addModule(kabcfg ); | 1423 | ConfigureDialog->addModule(kabcfg ); |
1424 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 1424 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
1425 | ConfigureDialog->addModule(kdelibcfg ); | 1425 | ConfigureDialog->addModule(kdelibcfg ); |
1426 | 1426 | ||
1427 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1427 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1428 | this, SLOT( configurationChanged() ) ); | 1428 | this, SLOT( configurationChanged() ) ); |
1429 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1429 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1430 | this, SLOT( configurationChanged() ) ); | 1430 | this, SLOT( configurationChanged() ) ); |
1431 | saveSettings(); | 1431 | saveSettings(); |
1432 | #ifndef DESKTOP_VERSION | 1432 | #ifndef DESKTOP_VERSION |
1433 | ConfigureDialog->showMaximized(); | 1433 | ConfigureDialog->showMaximized(); |
1434 | #endif | 1434 | #endif |
1435 | if ( ConfigureDialog->exec() ) | 1435 | if ( ConfigureDialog->exec() ) |
1436 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1436 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1437 | delete ConfigureDialog; | 1437 | delete ConfigureDialog; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | void KABCore::openLDAPDialog() | 1440 | void KABCore::openLDAPDialog() |
1441 | { | 1441 | { |
1442 | #ifndef KAB_EMBEDDED | 1442 | #ifndef KAB_EMBEDDED |
1443 | if ( !mLdapSearchDialog ) { | 1443 | if ( !mLdapSearchDialog ) { |
1444 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1444 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1445 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1445 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1446 | SLOT( refreshView() ) ); | 1446 | SLOT( refreshView() ) ); |
1447 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1447 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1448 | SLOT( setModified() ) ); | 1448 | SLOT( setModified() ) ); |
1449 | } else | 1449 | } else |
1450 | mLdapSearchDialog->restoreSettings(); | 1450 | mLdapSearchDialog->restoreSettings(); |
1451 | 1451 | ||
1452 | if ( mLdapSearchDialog->isOK() ) | 1452 | if ( mLdapSearchDialog->isOK() ) |
1453 | mLdapSearchDialog->exec(); | 1453 | mLdapSearchDialog->exec(); |
1454 | #else //KAB_EMBEDDED | 1454 | #else //KAB_EMBEDDED |
1455 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1455 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1456 | #endif //KAB_EMBEDDED | 1456 | #endif //KAB_EMBEDDED |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | void KABCore::print() | 1459 | void KABCore::print() |
1460 | { | 1460 | { |
1461 | #ifndef KAB_EMBEDDED | 1461 | #ifndef KAB_EMBEDDED |
1462 | KPrinter printer; | 1462 | KPrinter printer; |
1463 | if ( !printer.setup( this ) ) | 1463 | if ( !printer.setup( this ) ) |
1464 | return; | 1464 | return; |
1465 | 1465 | ||
1466 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1466 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1467 | mViewManager->selectedUids(), this ); | 1467 | mViewManager->selectedUids(), this ); |
1468 | 1468 | ||
1469 | wizard.exec(); | 1469 | wizard.exec(); |
1470 | #else //KAB_EMBEDDED | 1470 | #else //KAB_EMBEDDED |
1471 | qDebug("KABCore::print() finsih method"); | 1471 | qDebug("KABCore::print() finsih method"); |
1472 | #endif //KAB_EMBEDDED | 1472 | #endif //KAB_EMBEDDED |
1473 | 1473 | ||
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | 1476 | ||
1477 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1477 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1478 | { | 1478 | { |
1479 | if ( mGUIClient ) | 1479 | if ( mGUIClient ) |
1480 | mGUIClient->insertChildClient( client ); | 1480 | mGUIClient->insertChildClient( client ); |
1481 | else | 1481 | else |
1482 | KMessageBox::error( this, "no KXMLGUICLient"); | 1482 | KMessageBox::error( this, "no KXMLGUICLient"); |
1483 | } | 1483 | } |
1484 | 1484 | ||
1485 | 1485 | ||
1486 | void KABCore::configurationChanged() | 1486 | void KABCore::configurationChanged() |
1487 | { | 1487 | { |
1488 | mExtensionManager->reconfigure(); | 1488 | mExtensionManager->reconfigure(); |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | void KABCore::addressBookChanged() | 1491 | void KABCore::addressBookChanged() |
1492 | { | 1492 | { |
1493 | /*US | 1493 | /*US |
1494 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1494 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1495 | while ( it.current() ) { | 1495 | while ( it.current() ) { |
1496 | if ( it.current()->dirty() ) { | 1496 | if ( it.current()->dirty() ) { |
1497 | QString text = i18n( "Data has been changed externally. Unsaved " | 1497 | QString text = i18n( "Data has been changed externally. Unsaved " |
1498 | "changes will be lost." ); | 1498 | "changes will be lost." ); |
1499 | KMessageBox::information( this, text ); | 1499 | KMessageBox::information( this, text ); |
1500 | } | 1500 | } |
1501 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1501 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1502 | ++it; | 1502 | ++it; |
1503 | } | 1503 | } |
1504 | */ | 1504 | */ |
1505 | if (mEditorDialog) | 1505 | if (mEditorDialog) |
1506 | { | 1506 | { |
1507 | if (mEditorDialog->dirty()) | 1507 | if (mEditorDialog->dirty()) |
1508 | { | 1508 | { |
1509 | QString text = i18n( "Data has been changed externally. Unsaved " | 1509 | QString text = i18n( "Data has been changed externally. Unsaved " |
1510 | "changes will be lost." ); | 1510 | "changes will be lost." ); |
1511 | KMessageBox::information( this, text ); | 1511 | KMessageBox::information( this, text ); |
1512 | } | 1512 | } |
1513 | QString currentuid = mEditorDialog->addressee().uid(); | 1513 | QString currentuid = mEditorDialog->addressee().uid(); |
1514 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1514 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1515 | } | 1515 | } |
1516 | mViewManager->refreshView(); | 1516 | mViewManager->refreshView(); |
1517 | // mDetails->refreshView(); | 1517 | // mDetails->refreshView(); |
1518 | 1518 | ||
1519 | 1519 | ||
1520 | } | 1520 | } |
1521 | 1521 | ||
1522 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1522 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1523 | const char *name ) | 1523 | const char *name ) |
1524 | { | 1524 | { |
1525 | 1525 | ||
1526 | if ( mEditorDialog == 0 ) { | 1526 | if ( mEditorDialog == 0 ) { |
1527 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1527 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1528 | name ? name : "editorDialog" ); | 1528 | name ? name : "editorDialog" ); |
1529 | 1529 | ||
1530 | 1530 | ||
1531 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1531 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1532 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1532 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1533 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1533 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1534 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1534 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | return mEditorDialog; | 1537 | return mEditorDialog; |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1540 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1541 | { | 1541 | { |
1542 | //mEditorDict.remove( uid ); | 1542 | //mEditorDict.remove( uid ); |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | void KABCore::initGUI() | 1545 | void KABCore::initGUI() |
1546 | { | 1546 | { |
1547 | #ifndef KAB_EMBEDDED | 1547 | #ifndef KAB_EMBEDDED |
1548 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1548 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1549 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1549 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1550 | 1550 | ||
1551 | mExtensionBarSplitter = new QSplitter( this ); | 1551 | mExtensionBarSplitter = new QSplitter( this ); |
1552 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1552 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1553 | 1553 | ||
1554 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1554 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1555 | 1555 | ||
1556 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1556 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1557 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1557 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1558 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1558 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1559 | SLOT( incrementalSearch( const QString& ) ) ); | 1559 | SLOT( incrementalSearch( const QString& ) ) ); |
1560 | 1560 | ||
1561 | mViewManager = new ViewManager( this, viewSpace ); | 1561 | mViewManager = new ViewManager( this, viewSpace ); |
1562 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1562 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1563 | 1563 | ||
1564 | mDetails = new ViewContainer( mDetailsSplitter ); | 1564 | mDetails = new ViewContainer( mDetailsSplitter ); |
1565 | 1565 | ||
1566 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1566 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1567 | 1567 | ||
1568 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1568 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1569 | 1569 | ||
1570 | topLayout->addWidget( mExtensionBarSplitter ); | 1570 | topLayout->addWidget( mExtensionBarSplitter ); |
1571 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1571 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1572 | topLayout->addWidget( mJumpButtonBar ); | 1572 | topLayout->addWidget( mJumpButtonBar ); |
1573 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1573 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1574 | 1574 | ||
1575 | mXXPortManager = new XXPortManager( this, this ); | 1575 | mXXPortManager = new XXPortManager( this, this ); |
1576 | 1576 | ||
1577 | #else //KAB_EMBEDDED | 1577 | #else //KAB_EMBEDDED |
1578 | //US initialize viewMenu before settingup viewmanager. | 1578 | //US initialize viewMenu before settingup viewmanager. |
1579 | // Viewmanager needs this menu to plugin submenues. | 1579 | // Viewmanager needs this menu to plugin submenues. |
1580 | viewMenu = new QPopupMenu( this ); | 1580 | viewMenu = new QPopupMenu( this ); |
1581 | settingsMenu = new QPopupMenu( this ); | 1581 | settingsMenu = new QPopupMenu( this ); |
1582 | //filterMenu = new QPopupMenu( this ); | 1582 | //filterMenu = new QPopupMenu( this ); |
1583 | ImportMenu = new QPopupMenu( this ); | 1583 | ImportMenu = new QPopupMenu( this ); |
1584 | ExportMenu = new QPopupMenu( this ); | 1584 | ExportMenu = new QPopupMenu( this ); |
1585 | syncMenu = new QPopupMenu( this ); | 1585 | syncMenu = new QPopupMenu( this ); |
1586 | changeMenu= new QPopupMenu( this ); | 1586 | changeMenu= new QPopupMenu( this ); |
1587 | 1587 | ||
1588 | //US since we have no splitter for the embedded system, setup | 1588 | //US since we have no splitter for the embedded system, setup |
1589 | // a layout with two frames. One left and one right. | 1589 | // a layout with two frames. One left and one right. |
1590 | 1590 | ||
1591 | QBoxLayout *topLayout; | 1591 | QBoxLayout *topLayout; |
1592 | 1592 | ||
1593 | // = new QHBoxLayout( this ); | 1593 | // = new QHBoxLayout( this ); |
1594 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1594 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1595 | 1595 | ||
1596 | // QWidget *mainBox = new QWidget( this ); | 1596 | // QWidget *mainBox = new QWidget( this ); |
1597 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1597 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1598 | 1598 | ||
1599 | #ifdef DESKTOP_VERSION | 1599 | #ifdef DESKTOP_VERSION |
1600 | topLayout = new QHBoxLayout( this ); | 1600 | topLayout = new QHBoxLayout( this ); |
1601 | 1601 | ||
1602 | 1602 | ||
1603 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1603 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1604 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1604 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1605 | 1605 | ||
1606 | topLayout->addWidget(mMiniSplitter ); | 1606 | topLayout->addWidget(mMiniSplitter ); |
1607 | 1607 | ||
1608 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1608 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1609 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1609 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1610 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1610 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1611 | mDetails = new ViewContainer( mMiniSplitter ); | 1611 | mDetails = new ViewContainer( mMiniSplitter ); |
1612 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1612 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1613 | #else | 1613 | #else |
1614 | if ( QApplication::desktop()->width() > 480 ) { | 1614 | if ( QApplication::desktop()->width() > 480 ) { |
1615 | topLayout = new QHBoxLayout( this ); | 1615 | topLayout = new QHBoxLayout( this ); |
1616 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1616 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1617 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1617 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1618 | } else { | 1618 | } else { |
1619 | 1619 | ||
1620 | topLayout = new QHBoxLayout( this ); | 1620 | topLayout = new QHBoxLayout( this ); |
1621 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1621 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1622 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1622 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | topLayout->addWidget(mMiniSplitter ); | 1625 | topLayout->addWidget(mMiniSplitter ); |
1626 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1626 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1627 | mDetails = new ViewContainer( mMiniSplitter ); | 1627 | mDetails = new ViewContainer( mMiniSplitter ); |
1628 | 1628 | ||
1629 | 1629 | ||
1630 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1630 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1631 | #endif | 1631 | #endif |
1632 | //eh->hide(); | 1632 | //eh->hide(); |
1633 | // topLayout->addWidget(mExtensionManager ); | 1633 | // topLayout->addWidget(mExtensionManager ); |
1634 | 1634 | ||
1635 | 1635 | ||
1636 | /*US | 1636 | /*US |
1637 | #ifndef KAB_NOSPLITTER | 1637 | #ifndef KAB_NOSPLITTER |
1638 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1638 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1639 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1639 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1640 | topLayout->setSpacing( 10 ); | 1640 | topLayout->setSpacing( 10 ); |
1641 | 1641 | ||
1642 | mDetailsSplitter = new QSplitter( this ); | 1642 | mDetailsSplitter = new QSplitter( this ); |
1643 | 1643 | ||
1644 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1644 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1645 | 1645 | ||
1646 | mViewManager = new ViewManager( this, viewSpace ); | 1646 | mViewManager = new ViewManager( this, viewSpace ); |
1647 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1647 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1648 | 1648 | ||
1649 | mDetails = new ViewContainer( mDetailsSplitter ); | 1649 | mDetails = new ViewContainer( mDetailsSplitter ); |
1650 | 1650 | ||
1651 | topLayout->addWidget( mDetailsSplitter ); | 1651 | topLayout->addWidget( mDetailsSplitter ); |
1652 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1652 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1653 | #else //KAB_NOSPLITTER | 1653 | #else //KAB_NOSPLITTER |
1654 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1654 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1655 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1655 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1656 | topLayout->setSpacing( 10 ); | 1656 | topLayout->setSpacing( 10 ); |
1657 | 1657 | ||
1658 | // mDetailsSplitter = new QSplitter( this ); | 1658 | // mDetailsSplitter = new QSplitter( this ); |
1659 | 1659 | ||
1660 | QVBox *viewSpace = new QVBox( this ); | 1660 | QVBox *viewSpace = new QVBox( this ); |
1661 | 1661 | ||
1662 | mViewManager = new ViewManager( this, viewSpace ); | 1662 | mViewManager = new ViewManager( this, viewSpace ); |
1663 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1663 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1664 | 1664 | ||
1665 | mDetails = new ViewContainer( this ); | 1665 | mDetails = new ViewContainer( this ); |
1666 | 1666 | ||
1667 | topLayout->addWidget( viewSpace ); | 1667 | topLayout->addWidget( viewSpace ); |
1668 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1668 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1669 | topLayout->addWidget( mDetails ); | 1669 | topLayout->addWidget( mDetails ); |
1670 | #endif //KAB_NOSPLITTER | 1670 | #endif //KAB_NOSPLITTER |
1671 | */ | 1671 | */ |
1672 | 1672 | ||
1673 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1673 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1674 | syncManager->setBlockSave(false); | 1674 | syncManager->setBlockSave(false); |
1675 | 1675 | ||
1676 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1676 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1677 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1677 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1678 | syncManager->setDefaultFileName( sentSyncFile()); | 1678 | syncManager->setDefaultFileName( sentSyncFile()); |
1679 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1679 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1680 | 1680 | ||
1681 | #endif //KAB_EMBEDDED | 1681 | #endif //KAB_EMBEDDED |
1682 | initActions(); | 1682 | initActions(); |
1683 | 1683 | ||
1684 | #ifdef KAB_EMBEDDED | 1684 | #ifdef KAB_EMBEDDED |
1685 | addActionsManually(); | 1685 | addActionsManually(); |
1686 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1686 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1687 | mXXPortManager = new XXPortManager( this, this ); | 1687 | mXXPortManager = new XXPortManager( this, this ); |
1688 | 1688 | ||
1689 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1689 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1690 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1690 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1691 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1691 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1692 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1692 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1693 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1693 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1694 | // mIncSearchWidget->hide(); | 1694 | // mIncSearchWidget->hide(); |
1695 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1695 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1696 | SLOT( incrementalSearch( const QString& ) ) ); | 1696 | SLOT( incrementalSearch( const QString& ) ) ); |
1697 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1697 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1698 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1698 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1699 | 1699 | ||
1700 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1700 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1701 | 1701 | ||
1702 | topLayout->addWidget( mJumpButtonBar ); | 1702 | topLayout->addWidget( mJumpButtonBar ); |
1703 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1703 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1704 | 1704 | ||
1705 | // mMainWindow->getIconToolBar()->raise(); | 1705 | // mMainWindow->getIconToolBar()->raise(); |
1706 | 1706 | ||
1707 | #endif //KAB_EMBEDDED | 1707 | #endif //KAB_EMBEDDED |
1708 | 1708 | ||
1709 | } | 1709 | } |
1710 | void KABCore::initActions() | 1710 | void KABCore::initActions() |
1711 | { | 1711 | { |
1712 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1712 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1713 | 1713 | ||
1714 | #ifndef KAB_EMBEDDED | 1714 | #ifndef KAB_EMBEDDED |
1715 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1715 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1716 | SLOT( clipboardDataChanged() ) ); | 1716 | SLOT( clipboardDataChanged() ) ); |
1717 | #endif //KAB_EMBEDDED | 1717 | #endif //KAB_EMBEDDED |
1718 | 1718 | ||
1719 | // file menu | 1719 | // file menu |
1720 | if ( mIsPart ) { | 1720 | if ( mIsPart ) { |
1721 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1721 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1722 | SLOT( sendMail() ), actionCollection(), | 1722 | SLOT( sendMail() ), actionCollection(), |
1723 | "kaddressbook_mail" ); | 1723 | "kaddressbook_mail" ); |
1724 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1724 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1725 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1725 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1726 | 1726 | ||
1727 | } else { | 1727 | } else { |
1728 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1728 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1729 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1729 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1730 | } | 1730 | } |
1731 | 1731 | ||
1732 | 1732 | ||
1733 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1733 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1734 | SLOT( save() ), actionCollection(), "file_sync" ); | 1734 | SLOT( save() ), actionCollection(), "file_sync" ); |
1735 | 1735 | ||
1736 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1736 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1737 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1737 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1738 | 1738 | ||
1739 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1739 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1740 | this, SLOT( mailVCard() ), | 1740 | this, SLOT( mailVCard() ), |
1741 | actionCollection(), "file_mail_vcard"); | 1741 | actionCollection(), "file_mail_vcard"); |
1742 | 1742 | ||
1743 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, | 1743 | mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, |
1744 | SLOT( export2phone() ), actionCollection(), | 1744 | SLOT( export2phone() ), actionCollection(), |
1745 | "kaddressbook_ex2phone" ); | 1745 | "kaddressbook_ex2phone" ); |
1746 | 1746 | ||
1747 | mActionBeamVCard = 0; | 1747 | mActionBeamVCard = 0; |
1748 | mActionBeam = 0; | 1748 | mActionBeam = 0; |
1749 | 1749 | ||
1750 | #ifndef DESKTOP_VERSION | 1750 | #ifndef DESKTOP_VERSION |
1751 | if ( Ir::supported() ) { | 1751 | if ( Ir::supported() ) { |
1752 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, | 1752 | mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, |
1753 | SLOT( beamVCard() ), actionCollection(), | 1753 | SLOT( beamVCard() ), actionCollection(), |
1754 | "kaddressbook_beam_vcard" ); | 1754 | "kaddressbook_beam_vcard" ); |
1755 | 1755 | ||
1756 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1756 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1757 | SLOT( beamMySelf() ), actionCollection(), | 1757 | SLOT( beamMySelf() ), actionCollection(), |
1758 | "kaddressbook_beam_myself" ); | 1758 | "kaddressbook_beam_myself" ); |
1759 | } | 1759 | } |
1760 | #endif | 1760 | #endif |
1761 | 1761 | ||
1762 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1762 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1763 | this, SLOT( editContact2() ), | 1763 | this, SLOT( editContact2() ), |
1764 | actionCollection(), "file_properties" ); | 1764 | actionCollection(), "file_properties" ); |
1765 | 1765 | ||
1766 | #ifdef KAB_EMBEDDED | 1766 | #ifdef KAB_EMBEDDED |
1767 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1767 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1768 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1768 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1769 | mMainWindow, SLOT( exit() ), | 1769 | mMainWindow, SLOT( exit() ), |
1770 | actionCollection(), "quit" ); | 1770 | actionCollection(), "quit" ); |
1771 | #endif //KAB_EMBEDDED | 1771 | #endif //KAB_EMBEDDED |
1772 | 1772 | ||
1773 | // edit menu | 1773 | // edit menu |
1774 | if ( mIsPart ) { | 1774 | if ( mIsPart ) { |
1775 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1775 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1776 | SLOT( copyContacts() ), actionCollection(), | 1776 | SLOT( copyContacts() ), actionCollection(), |
1777 | "kaddressbook_copy" ); | 1777 | "kaddressbook_copy" ); |
1778 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1778 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1779 | SLOT( cutContacts() ), actionCollection(), | 1779 | SLOT( cutContacts() ), actionCollection(), |
1780 | "kaddressbook_cut" ); | 1780 | "kaddressbook_cut" ); |
1781 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1781 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1782 | SLOT( pasteContacts() ), actionCollection(), | 1782 | SLOT( pasteContacts() ), actionCollection(), |
1783 | "kaddressbook_paste" ); | 1783 | "kaddressbook_paste" ); |
1784 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1784 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1785 | SLOT( selectAllContacts() ), actionCollection(), | 1785 | SLOT( selectAllContacts() ), actionCollection(), |
1786 | "kaddressbook_select_all" ); | 1786 | "kaddressbook_select_all" ); |
1787 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1787 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1788 | SLOT( undo() ), actionCollection(), | 1788 | SLOT( undo() ), actionCollection(), |
1789 | "kaddressbook_undo" ); | 1789 | "kaddressbook_undo" ); |
1790 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1790 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1791 | this, SLOT( redo() ), actionCollection(), | 1791 | this, SLOT( redo() ), actionCollection(), |
1792 | "kaddressbook_redo" ); | 1792 | "kaddressbook_redo" ); |
1793 | } else { | 1793 | } else { |
1794 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1794 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1795 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1795 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1796 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1796 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1797 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1797 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1798 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1798 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1799 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1799 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1802 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1803 | Key_Delete, this, SLOT( deleteContacts() ), | 1803 | Key_Delete, this, SLOT( deleteContacts() ), |
1804 | actionCollection(), "edit_delete" ); | 1804 | actionCollection(), "edit_delete" ); |
1805 | 1805 | ||
1806 | mActionUndo->setEnabled( false ); | 1806 | mActionUndo->setEnabled( false ); |
1807 | mActionRedo->setEnabled( false ); | 1807 | mActionRedo->setEnabled( false ); |
1808 | 1808 | ||
1809 | // settings menu | 1809 | // settings menu |
1810 | #ifdef KAB_EMBEDDED | 1810 | #ifdef KAB_EMBEDDED |
1811 | //US special menuentry to configure the addressbook resources. On KDE | 1811 | //US special menuentry to configure the addressbook resources. On KDE |
1812 | // you do that through the control center !!! | 1812 | // you do that through the control center !!! |
1813 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1813 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1814 | SLOT( configureResources() ), actionCollection(), | 1814 | SLOT( configureResources() ), actionCollection(), |
1815 | "kaddressbook_configure_resources" ); | 1815 | "kaddressbook_configure_resources" ); |
1816 | #endif //KAB_EMBEDDED | 1816 | #endif //KAB_EMBEDDED |
1817 | 1817 | ||
1818 | if ( mIsPart ) { | 1818 | if ( mIsPart ) { |
1819 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1819 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1820 | SLOT( openConfigDialog() ), actionCollection(), | 1820 | SLOT( openConfigDialog() ), actionCollection(), |
1821 | "kaddressbook_configure" ); | 1821 | "kaddressbook_configure" ); |
1822 | 1822 | ||
1823 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1823 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1824 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1824 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1825 | "kaddressbook_configure_shortcuts" ); | 1825 | "kaddressbook_configure_shortcuts" ); |
1826 | #ifdef KAB_EMBEDDED | 1826 | #ifdef KAB_EMBEDDED |
1827 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1827 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1828 | mActionConfigureToolbars->setEnabled( false ); | 1828 | mActionConfigureToolbars->setEnabled( false ); |
1829 | #endif //KAB_EMBEDDED | 1829 | #endif //KAB_EMBEDDED |
1830 | 1830 | ||
1831 | } else { | 1831 | } else { |
1832 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1832 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1833 | 1833 | ||
1834 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1834 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1837 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1838 | actionCollection(), "options_show_jump_bar" ); | 1838 | actionCollection(), "options_show_jump_bar" ); |
1839 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1839 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1840 | 1840 | ||
1841 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 1841 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
1842 | actionCollection(), "options_show_details" ); | 1842 | actionCollection(), "options_show_details" ); |
1843 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1843 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1844 | 1844 | ||
1845 | 1845 | ||
1846 | mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this, | 1846 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
1847 | SLOT( toggleBeamReceive() ), actionCollection(), | 1847 | SLOT( toggleBeamReceive() ), actionCollection(), |
1848 | "kaddressbook_beam_rec" ); | 1848 | "kaddressbook_beam_rec" ); |
1849 | 1849 | ||
1850 | 1850 | ||
1851 | // misc | 1851 | // misc |
1852 | // only enable LDAP lookup if we can handle the protocol | 1852 | // only enable LDAP lookup if we can handle the protocol |
1853 | #ifndef KAB_EMBEDDED | 1853 | #ifndef KAB_EMBEDDED |
1854 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1854 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1855 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1855 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1856 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1856 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1857 | "ldap_lookup" ); | 1857 | "ldap_lookup" ); |
1858 | } | 1858 | } |
1859 | #else //KAB_EMBEDDED | 1859 | #else //KAB_EMBEDDED |
1860 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1860 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1861 | #endif //KAB_EMBEDDED | 1861 | #endif //KAB_EMBEDDED |
1862 | 1862 | ||
1863 | 1863 | ||
1864 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1864 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1865 | SLOT( setWhoAmI() ), actionCollection(), | 1865 | SLOT( setWhoAmI() ), actionCollection(), |
1866 | "set_personal" ); | 1866 | "set_personal" ); |
1867 | 1867 | ||
1868 | 1868 | ||
1869 | 1869 | ||
1870 | 1870 | ||
1871 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1871 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1872 | SLOT( setCategories() ), actionCollection(), | 1872 | SLOT( setCategories() ), actionCollection(), |
1873 | "edit_set_categories" ); | 1873 | "edit_set_categories" ); |
1874 | 1874 | ||
1875 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 1875 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
1876 | SLOT( removeVoice() ), actionCollection(), | 1876 | SLOT( removeVoice() ), actionCollection(), |
1877 | "remove_voice" ); | 1877 | "remove_voice" ); |
1878 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 1878 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
1879 | SLOT( importFromOL() ), actionCollection(), | 1879 | SLOT( importFromOL() ), actionCollection(), |
1880 | "import_OL" ); | 1880 | "import_OL" ); |
1881 | #ifdef KAB_EMBEDDED | 1881 | #ifdef KAB_EMBEDDED |
1882 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 1882 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
1883 | this, SLOT( showLicence() ), actionCollection(), | 1883 | this, SLOT( showLicence() ), actionCollection(), |
1884 | "licence_about_data" ); | 1884 | "licence_about_data" ); |
1885 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 1885 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
1886 | this, SLOT( faq() ), actionCollection(), | 1886 | this, SLOT( faq() ), actionCollection(), |
1887 | "faq_about_data" ); | 1887 | "faq_about_data" ); |
1888 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 1888 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
1889 | this, SLOT( whatsnew() ), actionCollection(), | 1889 | this, SLOT( whatsnew() ), actionCollection(), |
1890 | "wn" ); | 1890 | "wn" ); |
1891 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 1891 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
1892 | this, SLOT( synchowto() ), actionCollection(), | 1892 | this, SLOT( synchowto() ), actionCollection(), |
1893 | "sync" ); | 1893 | "sync" ); |
1894 | 1894 | ||
1895 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1895 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1896 | this, SLOT( createAboutData() ), actionCollection(), | 1896 | this, SLOT( createAboutData() ), actionCollection(), |
1897 | "kaddressbook_about_data" ); | 1897 | "kaddressbook_about_data" ); |
1898 | #endif //KAB_EMBEDDED | 1898 | #endif //KAB_EMBEDDED |
1899 | 1899 | ||
1900 | clipboardDataChanged(); | 1900 | clipboardDataChanged(); |
1901 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1901 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1902 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1902 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | //US we need this function, to plug all actions into the correct menues. | 1905 | //US we need this function, to plug all actions into the correct menues. |
1906 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1906 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1907 | void KABCore::addActionsManually() | 1907 | void KABCore::addActionsManually() |
1908 | { | 1908 | { |
1909 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1909 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1910 | 1910 | ||
1911 | #ifdef KAB_EMBEDDED | 1911 | #ifdef KAB_EMBEDDED |
1912 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1912 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1913 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1913 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1914 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1914 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1915 | 1915 | ||
1916 | KToolBar* tb = mMainWindow->toolBar(); | 1916 | KToolBar* tb = mMainWindow->toolBar(); |
1917 | 1917 | ||
1918 | #ifdef DESKTOP_VERSION | 1918 | #ifdef DESKTOP_VERSION |
1919 | QMenuBar* mb = mMainWindow->menuBar(); | 1919 | QMenuBar* mb = mMainWindow->menuBar(); |
1920 | 1920 | ||
1921 | //US setup menubar. | 1921 | //US setup menubar. |
1922 | //Disable the following block if you do not want to have a menubar. | 1922 | //Disable the following block if you do not want to have a menubar. |
1923 | mb->insertItem( "&File", fileMenu ); | 1923 | mb->insertItem( "&File", fileMenu ); |
1924 | mb->insertItem( "&Edit", editMenu ); | 1924 | mb->insertItem( "&Edit", editMenu ); |
1925 | mb->insertItem( "&View", viewMenu ); | 1925 | mb->insertItem( "&View", viewMenu ); |
1926 | mb->insertItem( "&Settings", settingsMenu ); | 1926 | mb->insertItem( "&Settings", settingsMenu ); |
1927 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 1927 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
1928 | mb->insertItem( "&Change selected", changeMenu ); | 1928 | mb->insertItem( "&Change selected", changeMenu ); |
1929 | mb->insertItem( "&Help", helpMenu ); | 1929 | mb->insertItem( "&Help", helpMenu ); |
1930 | mIncSearchWidget = new IncSearchWidget( tb ); | 1930 | mIncSearchWidget = new IncSearchWidget( tb ); |
1931 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1931 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1932 | 1932 | ||
1933 | #else | 1933 | #else |
1934 | //US setup toolbar | 1934 | //US setup toolbar |
1935 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 1935 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
1936 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1936 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1937 | menuBarTB->insertItem( "ME", popupBarTB); | 1937 | menuBarTB->insertItem( "ME", popupBarTB); |
1938 | tb->insertWidget(-1, 0, menuBarTB); | 1938 | tb->insertWidget(-1, 0, menuBarTB); |
1939 | mIncSearchWidget = new IncSearchWidget( tb ); | 1939 | mIncSearchWidget = new IncSearchWidget( tb ); |
1940 | 1940 | ||
1941 | tb->enableMoving(false); | 1941 | tb->enableMoving(false); |
1942 | popupBarTB->insertItem( "&File", fileMenu ); | 1942 | popupBarTB->insertItem( "&File", fileMenu ); |
1943 | popupBarTB->insertItem( "&Edit", editMenu ); | 1943 | popupBarTB->insertItem( "&Edit", editMenu ); |
1944 | popupBarTB->insertItem( "&View", viewMenu ); | 1944 | popupBarTB->insertItem( "&View", viewMenu ); |
1945 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1945 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1946 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 1946 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
1947 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1947 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1948 | popupBarTB->insertItem( "&Change selected", changeMenu ); | 1948 | popupBarTB->insertItem( "&Change selected", changeMenu ); |
1949 | popupBarTB->insertItem( "&Help", helpMenu ); | 1949 | popupBarTB->insertItem( "&Help", helpMenu ); |
1950 | if (QApplication::desktop()->width() > 320 ) { | 1950 | if (QApplication::desktop()->width() > 320 ) { |
1951 | // mViewManager->getFilterAction()->plug ( tb); | 1951 | // mViewManager->getFilterAction()->plug ( tb); |
1952 | } | 1952 | } |
1953 | #endif | 1953 | #endif |
1954 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1954 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1955 | 1955 | ||
1956 | 1956 | ||
1957 | 1957 | ||
1958 | //US Now connect the actions with the menue entries. | 1958 | //US Now connect the actions with the menue entries. |
1959 | mActionPrint->plug( fileMenu ); | 1959 | mActionPrint->plug( fileMenu ); |
1960 | mActionMail->plug( fileMenu ); | 1960 | mActionMail->plug( fileMenu ); |
1961 | fileMenu->insertSeparator(); | 1961 | fileMenu->insertSeparator(); |
1962 | 1962 | ||
1963 | mActionNewContact->plug( fileMenu ); | 1963 | mActionNewContact->plug( fileMenu ); |
1964 | mActionNewContact->plug( tb ); | 1964 | mActionNewContact->plug( tb ); |
1965 | 1965 | ||
1966 | mActionEditAddressee->plug( fileMenu ); | 1966 | mActionEditAddressee->plug( fileMenu ); |
1967 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 1967 | if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
1968 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 1968 | (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
1969 | mActionEditAddressee->plug( tb ); | 1969 | mActionEditAddressee->plug( tb ); |
1970 | 1970 | ||
1971 | fileMenu->insertSeparator(); | 1971 | fileMenu->insertSeparator(); |
1972 | mActionSave->plug( fileMenu ); | 1972 | mActionSave->plug( fileMenu ); |
1973 | fileMenu->insertItem( "&Import", ImportMenu ); | 1973 | fileMenu->insertItem( "&Import", ImportMenu ); |
1974 | fileMenu->insertItem( "&Export", ExportMenu ); | 1974 | fileMenu->insertItem( "&Export", ExportMenu ); |
1975 | fileMenu->insertSeparator(); | 1975 | fileMenu->insertSeparator(); |
1976 | mActionMailVCard->plug( fileMenu ); | 1976 | mActionMailVCard->plug( fileMenu ); |
1977 | #ifndef DESKTOP_VERSION | 1977 | #ifndef DESKTOP_VERSION |
1978 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); | 1978 | if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); |
1979 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); | 1979 | if ( Ir::supported() ) mActionBeam->plug(fileMenu ); |
1980 | #endif | 1980 | #endif |
1981 | fileMenu->insertSeparator(); | 1981 | fileMenu->insertSeparator(); |
1982 | mActionQuit->plug( fileMenu ); | 1982 | mActionQuit->plug( fileMenu ); |
1983 | #ifdef _WIN32_ | 1983 | #ifdef _WIN32_ |
1984 | mActionImportOL->plug( ImportMenu ); | 1984 | mActionImportOL->plug( ImportMenu ); |
1985 | #endif | 1985 | #endif |
1986 | // edit menu | 1986 | // edit menu |
1987 | mActionUndo->plug( editMenu ); | 1987 | mActionUndo->plug( editMenu ); |
1988 | mActionRedo->plug( editMenu ); | 1988 | mActionRedo->plug( editMenu ); |
1989 | editMenu->insertSeparator(); | 1989 | editMenu->insertSeparator(); |
1990 | mActionCut->plug( editMenu ); | 1990 | mActionCut->plug( editMenu ); |
1991 | mActionCopy->plug( editMenu ); | 1991 | mActionCopy->plug( editMenu ); |
1992 | mActionPaste->plug( editMenu ); | 1992 | mActionPaste->plug( editMenu ); |
1993 | mActionDelete->plug( editMenu ); | 1993 | mActionDelete->plug( editMenu ); |
1994 | editMenu->insertSeparator(); | 1994 | editMenu->insertSeparator(); |
1995 | mActionSelectAll->plug( editMenu ); | 1995 | mActionSelectAll->plug( editMenu ); |
1996 | 1996 | ||
1997 | mActionRemoveVoice->plug( changeMenu ); | 1997 | mActionRemoveVoice->plug( changeMenu ); |
1998 | // settings menu | 1998 | // settings menu |
1999 | //US special menuentry to configure the addressbook resources. On KDE | 1999 | //US special menuentry to configure the addressbook resources. On KDE |
2000 | // you do that through the control center !!! | 2000 | // you do that through the control center !!! |
2001 | mActionConfigResources->plug( settingsMenu ); | 2001 | mActionConfigResources->plug( settingsMenu ); |
2002 | settingsMenu->insertSeparator(); | 2002 | settingsMenu->insertSeparator(); |
2003 | 2003 | ||
2004 | mActionConfigKAddressbook->plug( settingsMenu ); | 2004 | mActionConfigKAddressbook->plug( settingsMenu ); |
2005 | 2005 | ||
2006 | if ( mIsPart ) { | 2006 | if ( mIsPart ) { |
2007 | mActionConfigShortcuts->plug( settingsMenu ); | 2007 | mActionConfigShortcuts->plug( settingsMenu ); |
2008 | mActionConfigureToolbars->plug( settingsMenu ); | 2008 | mActionConfigureToolbars->plug( settingsMenu ); |
2009 | 2009 | ||
2010 | } else { | 2010 | } else { |
2011 | mActionKeyBindings->plug( settingsMenu ); | 2011 | mActionKeyBindings->plug( settingsMenu ); |
2012 | } | 2012 | } |
2013 | 2013 | ||
2014 | settingsMenu->insertSeparator(); | 2014 | settingsMenu->insertSeparator(); |
2015 | 2015 | ||
2016 | mActionJumpBar->plug( settingsMenu ); | 2016 | mActionJumpBar->plug( settingsMenu ); |
2017 | mActionDetails->plug( settingsMenu ); | 2017 | mActionDetails->plug( settingsMenu ); |
2018 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2018 | if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2019 | mActionDetails->plug( tb ); | 2019 | mActionDetails->plug( tb ); |
2020 | settingsMenu->insertSeparator(); | 2020 | settingsMenu->insertSeparator(); |
2021 | mActionBR->plug(settingsMenu ); | 2021 | mActionBR->plug(settingsMenu ); |
2022 | settingsMenu->insertSeparator(); | 2022 | settingsMenu->insertSeparator(); |
2023 | 2023 | ||
2024 | mActionWhoAmI->plug( settingsMenu ); | 2024 | mActionWhoAmI->plug( settingsMenu ); |
2025 | mActionCategories->plug( settingsMenu ); | 2025 | mActionCategories->plug( settingsMenu ); |
2026 | 2026 | ||
2027 | 2027 | ||
2028 | mActionWN->plug( helpMenu ); | 2028 | mActionWN->plug( helpMenu ); |
2029 | mActionSyncHowto->plug( helpMenu ); | 2029 | mActionSyncHowto->plug( helpMenu ); |
2030 | mActionLicence->plug( helpMenu ); | 2030 | mActionLicence->plug( helpMenu ); |
2031 | mActionFaq->plug( helpMenu ); | 2031 | mActionFaq->plug( helpMenu ); |
2032 | mActionAboutKAddressbook->plug( helpMenu ); | 2032 | mActionAboutKAddressbook->plug( helpMenu ); |
2033 | 2033 | ||
2034 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2034 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2035 | 2035 | ||
2036 | mActionSave->plug( tb ); | 2036 | mActionSave->plug( tb ); |
2037 | mViewManager->getFilterAction()->plug ( tb); | 2037 | mViewManager->getFilterAction()->plug ( tb); |
2038 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2038 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { |
2039 | mActionUndo->plug( tb ); | 2039 | mActionUndo->plug( tb ); |
2040 | mActionDelete->plug( tb ); | 2040 | mActionDelete->plug( tb ); |
2041 | mActionRedo->plug( tb ); | 2041 | mActionRedo->plug( tb ); |
2042 | } | 2042 | } |
2043 | } | 2043 | } |
2044 | //mActionQuit->plug ( tb ); | 2044 | //mActionQuit->plug ( tb ); |
2045 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2045 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2046 | 2046 | ||
2047 | //US link the searchwidget first to this. | 2047 | //US link the searchwidget first to this. |
2048 | // The real linkage to the toolbar happens later. | 2048 | // The real linkage to the toolbar happens later. |
2049 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2049 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2050 | //US tb->insertItem( mIncSearchWidget ); | 2050 | //US tb->insertItem( mIncSearchWidget ); |
2051 | /*US | 2051 | /*US |
2052 | mIncSearchWidget = new IncSearchWidget( tb ); | 2052 | mIncSearchWidget = new IncSearchWidget( tb ); |
2053 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2053 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2054 | SLOT( incrementalSearch( const QString& ) ) ); | 2054 | SLOT( incrementalSearch( const QString& ) ) ); |
2055 | 2055 | ||
2056 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2056 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2057 | 2057 | ||
2058 | //US topLayout->addWidget( mJumpButtonBar ); | 2058 | //US topLayout->addWidget( mJumpButtonBar ); |
2059 | this->layout()->add( mJumpButtonBar ); | 2059 | this->layout()->add( mJumpButtonBar ); |
2060 | */ | 2060 | */ |
2061 | 2061 | ||
2062 | #endif //KAB_EMBEDDED | 2062 | #endif //KAB_EMBEDDED |
2063 | 2063 | ||
2064 | mActionExport2phone->plug( ExportMenu ); | 2064 | mActionExport2phone->plug( ExportMenu ); |
2065 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2065 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2066 | syncManager->fillSyncMenu(); | 2066 | syncManager->fillSyncMenu(); |
2067 | 2067 | ||
2068 | } | 2068 | } |
2069 | void KABCore::showLicence() | 2069 | void KABCore::showLicence() |
2070 | { | 2070 | { |
2071 | KApplication::showLicence(); | 2071 | KApplication::showLicence(); |
2072 | } | 2072 | } |
2073 | void KABCore::removeVoice() | 2073 | void KABCore::removeVoice() |
2074 | { | 2074 | { |
2075 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2075 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2076 | return; | 2076 | return; |
2077 | KABC::Addressee::List list = mViewManager->selectedAddressees(); | 2077 | KABC::Addressee::List list = mViewManager->selectedAddressees(); |
2078 | KABC::Addressee::List::Iterator it; | 2078 | KABC::Addressee::List::Iterator it; |
2079 | for ( it = list.begin(); it != list.end(); ++it ) { | 2079 | for ( it = list.begin(); it != list.end(); ++it ) { |
2080 | 2080 | ||
2081 | if ( (*it).removeVoice() ) | 2081 | if ( (*it).removeVoice() ) |
2082 | contactModified((*it) ); | 2082 | contactModified((*it) ); |
2083 | } | 2083 | } |
2084 | } | 2084 | } |
2085 | 2085 | ||
2086 | 2086 | ||
2087 | 2087 | ||
2088 | void KABCore::clipboardDataChanged() | 2088 | void KABCore::clipboardDataChanged() |
2089 | { | 2089 | { |
2090 | 2090 | ||
2091 | if ( mReadWrite ) | 2091 | if ( mReadWrite ) |
2092 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2092 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2093 | 2093 | ||
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | void KABCore::updateActionMenu() | 2096 | void KABCore::updateActionMenu() |
2097 | { | 2097 | { |
2098 | UndoStack *undo = UndoStack::instance(); | 2098 | UndoStack *undo = UndoStack::instance(); |
2099 | RedoStack *redo = RedoStack::instance(); | 2099 | RedoStack *redo = RedoStack::instance(); |
2100 | 2100 | ||
2101 | if ( undo->isEmpty() ) | 2101 | if ( undo->isEmpty() ) |
2102 | mActionUndo->setText( i18n( "Undo" ) ); | 2102 | mActionUndo->setText( i18n( "Undo" ) ); |
2103 | else | 2103 | else |
2104 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2104 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2105 | 2105 | ||
2106 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2106 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2107 | 2107 | ||
2108 | if ( !redo->top() ) | 2108 | if ( !redo->top() ) |
2109 | mActionRedo->setText( i18n( "Redo" ) ); | 2109 | mActionRedo->setText( i18n( "Redo" ) ); |
2110 | else | 2110 | else |
2111 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2111 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2112 | 2112 | ||
2113 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2113 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2114 | } | 2114 | } |
2115 | 2115 | ||
2116 | void KABCore::configureKeyBindings() | 2116 | void KABCore::configureKeyBindings() |
2117 | { | 2117 | { |
2118 | #ifndef KAB_EMBEDDED | 2118 | #ifndef KAB_EMBEDDED |
2119 | KKeyDialog::configure( actionCollection(), true ); | 2119 | KKeyDialog::configure( actionCollection(), true ); |
2120 | #else //KAB_EMBEDDED | 2120 | #else //KAB_EMBEDDED |
2121 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2121 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2122 | #endif //KAB_EMBEDDED | 2122 | #endif //KAB_EMBEDDED |
2123 | } | 2123 | } |
2124 | 2124 | ||
2125 | #ifdef KAB_EMBEDDED | 2125 | #ifdef KAB_EMBEDDED |
2126 | void KABCore::configureResources() | 2126 | void KABCore::configureResources() |
2127 | { | 2127 | { |
2128 | KRES::KCMKResources dlg( this, "" , 0 ); | 2128 | KRES::KCMKResources dlg( this, "" , 0 ); |
2129 | 2129 | ||
2130 | if ( !dlg.exec() ) | 2130 | if ( !dlg.exec() ) |
2131 | return; | 2131 | return; |
2132 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2132 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2133 | } | 2133 | } |
2134 | #endif //KAB_EMBEDDED | 2134 | #endif //KAB_EMBEDDED |
2135 | 2135 | ||
2136 | 2136 | ||
2137 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2137 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2138 | * for the attendees list of an event. | 2138 | * for the attendees list of an event. |
2139 | */ | 2139 | */ |
2140 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2140 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2141 | { | 2141 | { |
2142 | QStringList nameList; | 2142 | QStringList nameList; |
2143 | QStringList emailList; | 2143 | QStringList emailList; |
2144 | QStringList uidList; | 2144 | QStringList uidList; |
2145 | 2145 | ||
2146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2147 | uint i=0; | 2147 | uint i=0; |
2148 | for (i=0; i < list.count(); i++) | 2148 | for (i=0; i < list.count(); i++) |
2149 | { | 2149 | { |
2150 | nameList.append(list[i].realName()); | 2150 | nameList.append(list[i].realName()); |
2151 | emailList.append(list[i].preferredEmail()); | 2151 | emailList.append(list[i].preferredEmail()); |
2152 | uidList.append(list[i].uid()); | 2152 | uidList.append(list[i].uid()); |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); | 2155 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); |
2156 | 2156 | ||
2157 | } | 2157 | } |
2158 | 2158 | ||
2159 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2159 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2160 | * to put them into the calendar. | 2160 | * to put them into the calendar. |
2161 | */ | 2161 | */ |
2162 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2162 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2163 | { | 2163 | { |
2164 | // qDebug("KABCore::requestForBirthdayList"); | 2164 | // qDebug("KABCore::requestForBirthdayList"); |
2165 | QStringList birthdayList; | 2165 | QStringList birthdayList; |
2166 | QStringList anniversaryList; | 2166 | QStringList anniversaryList; |
2167 | QStringList realNameList; | 2167 | QStringList realNameList; |
2168 | QStringList preferredEmailList; | 2168 | QStringList preferredEmailList; |
2169 | QStringList assembledNameList; | 2169 | QStringList assembledNameList; |
2170 | QStringList uidList; | 2170 | QStringList uidList; |
2171 | 2171 | ||
2172 | KABC::AddressBook::Iterator it; | 2172 | KABC::AddressBook::Iterator it; |
2173 | 2173 | ||
2174 | int count = 0; | 2174 | int count = 0; |
2175 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2175 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2176 | ++count; | 2176 | ++count; |
2177 | } | 2177 | } |
2178 | QProgressBar bar(count,0 ); | 2178 | QProgressBar bar(count,0 ); |
2179 | int w = 300; | 2179 | int w = 300; |
2180 | if ( QApplication::desktop()->width() < 320 ) | 2180 | if ( QApplication::desktop()->width() < 320 ) |
2181 | w = 220; | 2181 | w = 220; |
2182 | int h = bar.sizeHint().height() ; | 2182 | int h = bar.sizeHint().height() ; |
2183 | int dw = QApplication::desktop()->width(); | 2183 | int dw = QApplication::desktop()->width(); |
2184 | int dh = QApplication::desktop()->height(); | 2184 | int dh = QApplication::desktop()->height(); |
2185 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2185 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2186 | bar.show(); | 2186 | bar.show(); |
2187 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2187 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2188 | qApp->processEvents(); | 2188 | qApp->processEvents(); |
2189 | 2189 | ||
2190 | QDate bday; | 2190 | QDate bday; |
2191 | QString anni; | 2191 | QString anni; |
2192 | QString formattedbday; | 2192 | QString formattedbday; |
2193 | 2193 | ||
2194 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2194 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2195 | { | 2195 | { |
2196 | if ( ! bar.isVisible() ) | 2196 | if ( ! bar.isVisible() ) |
2197 | return; | 2197 | return; |
2198 | bar.setProgress( count++ ); | 2198 | bar.setProgress( count++ ); |
2199 | qApp->processEvents(); | 2199 | qApp->processEvents(); |
2200 | bday = (*it).birthday().date(); | 2200 | bday = (*it).birthday().date(); |
2201 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2201 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2202 | 2202 | ||
2203 | if ( bday.isValid() || !anni.isEmpty()) | 2203 | if ( bday.isValid() || !anni.isEmpty()) |
2204 | { | 2204 | { |
2205 | if (bday.isValid()) | 2205 | if (bday.isValid()) |
2206 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2206 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2207 | else | 2207 | else |
2208 | formattedbday = "NOTVALID"; | 2208 | formattedbday = "NOTVALID"; |
2209 | if (anni.isEmpty()) | 2209 | if (anni.isEmpty()) |
2210 | anni = "INVALID"; | 2210 | anni = "INVALID"; |
2211 | 2211 | ||
2212 | birthdayList.append(formattedbday); | 2212 | birthdayList.append(formattedbday); |
2213 | anniversaryList.append(anni); //should be ISODate | 2213 | anniversaryList.append(anni); //should be ISODate |
2214 | realNameList.append((*it).realName()); | 2214 | realNameList.append((*it).realName()); |
2215 | preferredEmailList.append((*it).preferredEmail()); | 2215 | preferredEmailList.append((*it).preferredEmail()); |
2216 | assembledNameList.append((*it).assembledName()); | 2216 | assembledNameList.append((*it).assembledName()); |
2217 | uidList.append((*it).uid()); | 2217 | uidList.append((*it).uid()); |
2218 | 2218 | ||
2219 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2219 | qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2220 | } | 2220 | } |
2221 | } | 2221 | } |
2222 | 2222 | ||
2223 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2223 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2224 | 2224 | ||
2225 | } | 2225 | } |
2226 | 2226 | ||
2227 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2227 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2228 | */ | 2228 | */ |
2229 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2229 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2230 | { | 2230 | { |
2231 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2231 | qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2232 | 2232 | ||
2233 | QString foundUid = QString::null; | 2233 | QString foundUid = QString::null; |
2234 | if ( ! uid.isEmpty() ) { | 2234 | if ( ! uid.isEmpty() ) { |
2235 | Addressee adrr = mAddressBook->findByUid( uid ); | 2235 | Addressee adrr = mAddressBook->findByUid( uid ); |
2236 | if ( !adrr.isEmpty() ) { | 2236 | if ( !adrr.isEmpty() ) { |
2237 | foundUid = uid; | 2237 | foundUid = uid; |
2238 | } | 2238 | } |
2239 | if ( email == "sendbacklist" ) { | 2239 | if ( email == "sendbacklist" ) { |
2240 | //qDebug("ssssssssssssssssssssssend "); | 2240 | //qDebug("ssssssssssssssssssssssend "); |
2241 | QStringList nameList; | 2241 | QStringList nameList; |
2242 | QStringList emailList; | 2242 | QStringList emailList; |
2243 | QStringList uidList; | 2243 | QStringList uidList; |
2244 | nameList.append(adrr.realName()); | 2244 | nameList.append(adrr.realName()); |
2245 | emailList = adrr.emails(); | 2245 | emailList = adrr.emails(); |
2246 | uidList.append( adrr.preferredEmail()); | 2246 | uidList.append( adrr.preferredEmail()); |
2247 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2247 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2248 | return; | 2248 | return; |
2249 | } | 2249 | } |
2250 | 2250 | ||
2251 | } | 2251 | } |
2252 | 2252 | ||
2253 | if ( email == "sendbacklist" ) | 2253 | if ( email == "sendbacklist" ) |
2254 | return; | 2254 | return; |
2255 | if (foundUid.isEmpty()) | 2255 | if (foundUid.isEmpty()) |
2256 | { | 2256 | { |
2257 | //find the uid of the person first | 2257 | //find the uid of the person first |
2258 | Addressee::List namelist; | 2258 | Addressee::List namelist; |
2259 | Addressee::List emaillist; | 2259 | Addressee::List emaillist; |
2260 | 2260 | ||
2261 | if (!name.isEmpty()) | 2261 | if (!name.isEmpty()) |
2262 | namelist = mAddressBook->findByName( name ); | 2262 | namelist = mAddressBook->findByName( name ); |
2263 | 2263 | ||
2264 | if (!email.isEmpty()) | 2264 | if (!email.isEmpty()) |
2265 | emaillist = mAddressBook->findByEmail( email ); | 2265 | emaillist = mAddressBook->findByEmail( email ); |
2266 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2266 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2267 | //check if we have a match in Namelist and Emaillist | 2267 | //check if we have a match in Namelist and Emaillist |
2268 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2268 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2269 | foundUid = emaillist[0].uid(); | 2269 | foundUid = emaillist[0].uid(); |
2270 | } | 2270 | } |
2271 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2271 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2272 | foundUid = namelist[0].uid(); | 2272 | foundUid = namelist[0].uid(); |
2273 | else | 2273 | else |
2274 | { | 2274 | { |
2275 | for (int i = 0; i < namelist.count(); i++) | 2275 | for (int i = 0; i < namelist.count(); i++) |
2276 | { | 2276 | { |
2277 | for (int j = 0; j < emaillist.count(); j++) | 2277 | for (int j = 0; j < emaillist.count(); j++) |
2278 | { | 2278 | { |
2279 | if (namelist[i] == emaillist[j]) | 2279 | if (namelist[i] == emaillist[j]) |
2280 | { | 2280 | { |
2281 | foundUid = namelist[i].uid(); | 2281 | foundUid = namelist[i].uid(); |
2282 | } | 2282 | } |
2283 | } | 2283 | } |
2284 | } | 2284 | } |
2285 | } | 2285 | } |
2286 | } | 2286 | } |
2287 | else | 2287 | else |
2288 | { | 2288 | { |
2289 | foundUid = uid; | 2289 | foundUid = uid; |
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | if (!foundUid.isEmpty()) | 2292 | if (!foundUid.isEmpty()) |
2293 | { | 2293 | { |
2294 | 2294 | ||
2295 | // raise Ka/Pi if it is in the background | 2295 | // raise Ka/Pi if it is in the background |
2296 | #ifndef DESKTOP_VERSION | 2296 | #ifndef DESKTOP_VERSION |
2297 | #ifndef KORG_NODCOP | 2297 | #ifndef KORG_NODCOP |
2298 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2298 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2299 | #endif | 2299 | #endif |
2300 | #endif | 2300 | #endif |
2301 | 2301 | ||
2302 | mMainWindow->showMaximized(); | 2302 | mMainWindow->showMaximized(); |
2303 | mMainWindow-> raise(); | 2303 | mMainWindow-> raise(); |
2304 | 2304 | ||
2305 | mViewManager->setSelected( "", false); | 2305 | mViewManager->setSelected( "", false); |
2306 | mViewManager->refreshView( "" ); | 2306 | mViewManager->refreshView( "" ); |
2307 | mViewManager->setSelected( foundUid, true ); | 2307 | mViewManager->setSelected( foundUid, true ); |
2308 | mViewManager->refreshView( foundUid ); | 2308 | mViewManager->refreshView( foundUid ); |
2309 | 2309 | ||
2310 | if ( !mMultipleViewsAtOnce ) | 2310 | if ( !mMultipleViewsAtOnce ) |
2311 | { | 2311 | { |
2312 | setDetailsVisible( true ); | 2312 | setDetailsVisible( true ); |
2313 | mActionDetails->setChecked(true); | 2313 | mActionDetails->setChecked(true); |
2314 | } | 2314 | } |
2315 | } | 2315 | } |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | void KABCore::whatsnew() | 2318 | void KABCore::whatsnew() |
2319 | { | 2319 | { |
2320 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2320 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2321 | } | 2321 | } |
2322 | void KABCore::synchowto() | 2322 | void KABCore::synchowto() |
2323 | { | 2323 | { |
2324 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2324 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2325 | } | 2325 | } |
2326 | 2326 | ||
2327 | void KABCore::faq() | 2327 | void KABCore::faq() |
2328 | { | 2328 | { |
2329 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2329 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2330 | } | 2330 | } |
2331 | 2331 | ||
2332 | #include <libkcal/syncdefines.h> | 2332 | #include <libkcal/syncdefines.h> |
2333 | 2333 | ||
2334 | KABC::Addressee KABCore::getLastSyncAddressee() | 2334 | KABC::Addressee KABCore::getLastSyncAddressee() |
2335 | { | 2335 | { |
2336 | Addressee lse; | 2336 | Addressee lse; |
2337 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2337 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2338 | 2338 | ||
2339 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2339 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2340 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2340 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2341 | if (lse.isEmpty()) { | 2341 | if (lse.isEmpty()) { |
2342 | qDebug("Creating new last-syncAddressee "); | 2342 | qDebug("Creating new last-syncAddressee "); |
2343 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2343 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2344 | QString sum = ""; | 2344 | QString sum = ""; |
2345 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2345 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2346 | sum = "E: "; | 2346 | sum = "E: "; |
2347 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2347 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2348 | lse.setRevision( mLastAddressbookSync ); | 2348 | lse.setRevision( mLastAddressbookSync ); |
2349 | lse.setCategories( i18n("SyncEvent") ); | 2349 | lse.setCategories( i18n("SyncEvent") ); |
2350 | mAddressBook->insertAddressee( lse ); | 2350 | mAddressBook->insertAddressee( lse ); |
2351 | } | 2351 | } |
2352 | return lse; | 2352 | return lse; |
2353 | } | 2353 | } |
2354 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2354 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2355 | { | 2355 | { |
2356 | 2356 | ||
2357 | //void setZaurusId(int id); | 2357 | //void setZaurusId(int id); |
2358 | // int zaurusId() const; | 2358 | // int zaurusId() const; |
2359 | // void setZaurusUid(int id); | 2359 | // void setZaurusUid(int id); |
2360 | // int zaurusUid() const; | 2360 | // int zaurusUid() const; |
2361 | // void setZaurusStat(int id); | 2361 | // void setZaurusStat(int id); |
2362 | // int zaurusStat() const; | 2362 | // int zaurusStat() const; |
2363 | // 0 equal | 2363 | // 0 equal |
2364 | // 1 take local | 2364 | // 1 take local |
2365 | // 2 take remote | 2365 | // 2 take remote |
2366 | // 3 cancel | 2366 | // 3 cancel |
2367 | QDateTime lastSync = mLastAddressbookSync; | 2367 | QDateTime lastSync = mLastAddressbookSync; |
2368 | QDateTime localMod = local->revision(); | 2368 | QDateTime localMod = local->revision(); |
2369 | QDateTime remoteMod = remote->revision(); | 2369 | QDateTime remoteMod = remote->revision(); |
2370 | 2370 | ||
2371 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2371 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2372 | 2372 | ||
2373 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2373 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2374 | bool remCh, locCh; | 2374 | bool remCh, locCh; |
2375 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2375 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2376 | 2376 | ||
2377 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2377 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2378 | locCh = ( localMod > mLastAddressbookSync ); | 2378 | locCh = ( localMod > mLastAddressbookSync ); |
2379 | if ( !remCh && ! locCh ) { | 2379 | if ( !remCh && ! locCh ) { |
2380 | //qDebug("both not changed "); | 2380 | //qDebug("both not changed "); |
2381 | lastSync = localMod.addDays(1); | 2381 | lastSync = localMod.addDays(1); |
2382 | if ( mode <= SYNC_PREF_ASK ) | 2382 | if ( mode <= SYNC_PREF_ASK ) |
2383 | return 0; | 2383 | return 0; |
2384 | } else { | 2384 | } else { |
2385 | if ( locCh ) { | 2385 | if ( locCh ) { |
2386 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2386 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2387 | lastSync = localMod.addDays( -1 ); | 2387 | lastSync = localMod.addDays( -1 ); |
2388 | if ( !remCh ) | 2388 | if ( !remCh ) |
2389 | remoteMod =( lastSync.addDays( -1 ) ); | 2389 | remoteMod =( lastSync.addDays( -1 ) ); |
2390 | } else { | 2390 | } else { |
2391 | //qDebug(" not loc changed "); | 2391 | //qDebug(" not loc changed "); |
2392 | lastSync = localMod.addDays( 1 ); | 2392 | lastSync = localMod.addDays( 1 ); |
2393 | if ( remCh ) | 2393 | if ( remCh ) |
2394 | remoteMod =( lastSync.addDays( 1 ) ); | 2394 | remoteMod =( lastSync.addDays( 1 ) ); |
2395 | 2395 | ||
2396 | } | 2396 | } |
2397 | } | 2397 | } |
2398 | full = true; | 2398 | full = true; |
2399 | if ( mode < SYNC_PREF_ASK ) | 2399 | if ( mode < SYNC_PREF_ASK ) |
2400 | mode = SYNC_PREF_ASK; | 2400 | mode = SYNC_PREF_ASK; |
2401 | } else { | 2401 | } else { |
2402 | if ( localMod == remoteMod ) | 2402 | if ( localMod == remoteMod ) |
2403 | return 0; | 2403 | return 0; |
2404 | 2404 | ||
2405 | } | 2405 | } |
2406 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 2406 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
2407 | 2407 | ||
2408 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); | 2408 | //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); |
2409 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); | 2409 | //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); |
2410 | //full = true; //debug only | 2410 | //full = true; //debug only |
2411 | if ( full ) { | 2411 | if ( full ) { |
2412 | bool equ = ( (*local) == (*remote) ); | 2412 | bool equ = ( (*local) == (*remote) ); |
2413 | if ( equ ) { | 2413 | if ( equ ) { |
2414 | //qDebug("equal "); | 2414 | //qDebug("equal "); |
2415 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2415 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2416 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2416 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2417 | } | 2417 | } |
2418 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2418 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2419 | return 0; | 2419 | return 0; |
2420 | 2420 | ||
2421 | }//else //debug only | 2421 | }//else //debug only |
2422 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2422 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2423 | } | 2423 | } |
2424 | int result; | 2424 | int result; |
2425 | bool localIsNew; | 2425 | bool localIsNew; |
2426 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2426 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2427 | 2427 | ||
2428 | if ( full && mode < SYNC_PREF_NEWEST ) | 2428 | if ( full && mode < SYNC_PREF_NEWEST ) |
2429 | mode = SYNC_PREF_ASK; | 2429 | mode = SYNC_PREF_ASK; |
2430 | 2430 | ||
2431 | switch( mode ) { | 2431 | switch( mode ) { |
2432 | case SYNC_PREF_LOCAL: | 2432 | case SYNC_PREF_LOCAL: |
2433 | if ( lastSync > remoteMod ) | 2433 | if ( lastSync > remoteMod ) |
2434 | return 1; | 2434 | return 1; |
2435 | if ( lastSync > localMod ) | 2435 | if ( lastSync > localMod ) |
2436 | return 2; | 2436 | return 2; |
2437 | return 1; | 2437 | return 1; |
2438 | break; | 2438 | break; |
2439 | case SYNC_PREF_REMOTE: | 2439 | case SYNC_PREF_REMOTE: |
2440 | if ( lastSync > remoteMod ) | 2440 | if ( lastSync > remoteMod ) |
2441 | return 1; | 2441 | return 1; |
2442 | if ( lastSync > localMod ) | 2442 | if ( lastSync > localMod ) |
2443 | return 2; | 2443 | return 2; |
2444 | return 2; | 2444 | return 2; |
2445 | break; | 2445 | break; |
2446 | case SYNC_PREF_NEWEST: | 2446 | case SYNC_PREF_NEWEST: |
2447 | if ( localMod > remoteMod ) | 2447 | if ( localMod > remoteMod ) |
2448 | return 1; | 2448 | return 1; |
2449 | else | 2449 | else |
2450 | return 2; | 2450 | return 2; |
2451 | break; | 2451 | break; |
2452 | case SYNC_PREF_ASK: | 2452 | case SYNC_PREF_ASK: |
2453 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2453 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2454 | if ( lastSync > remoteMod ) | 2454 | if ( lastSync > remoteMod ) |
2455 | return 1; | 2455 | return 1; |
2456 | if ( lastSync > localMod ) | 2456 | if ( lastSync > localMod ) |
2457 | return 2; | 2457 | return 2; |
2458 | localIsNew = localMod >= remoteMod; | 2458 | localIsNew = localMod >= remoteMod; |
2459 | //qDebug("conflict! ************************************** "); | 2459 | //qDebug("conflict! ************************************** "); |
2460 | { | 2460 | { |
2461 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2461 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2462 | result = acd.executeD(localIsNew); | 2462 | result = acd.executeD(localIsNew); |
2463 | return result; | 2463 | return result; |
2464 | } | 2464 | } |
2465 | break; | 2465 | break; |
2466 | case SYNC_PREF_FORCE_LOCAL: | 2466 | case SYNC_PREF_FORCE_LOCAL: |
2467 | return 1; | 2467 | return 1; |
2468 | break; | 2468 | break; |
2469 | case SYNC_PREF_FORCE_REMOTE: | 2469 | case SYNC_PREF_FORCE_REMOTE: |
2470 | return 2; | 2470 | return 2; |
2471 | break; | 2471 | break; |
2472 | 2472 | ||
2473 | default: | 2473 | default: |
2474 | // SYNC_PREF_TAKE_BOTH not implemented | 2474 | // SYNC_PREF_TAKE_BOTH not implemented |
2475 | break; | 2475 | break; |
2476 | } | 2476 | } |
2477 | return 0; | 2477 | return 0; |
2478 | } | 2478 | } |
2479 | 2479 | ||
2480 | 2480 | ||
2481 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2481 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2482 | { | 2482 | { |
2483 | bool syncOK = true; | 2483 | bool syncOK = true; |
2484 | int addedAddressee = 0; | 2484 | int addedAddressee = 0; |
2485 | int addedAddresseeR = 0; | 2485 | int addedAddresseeR = 0; |
2486 | int deletedAddresseeR = 0; | 2486 | int deletedAddresseeR = 0; |
2487 | int deletedAddresseeL = 0; | 2487 | int deletedAddresseeL = 0; |
2488 | int changedLocal = 0; | 2488 | int changedLocal = 0; |
2489 | int changedRemote = 0; | 2489 | int changedRemote = 0; |
2490 | 2490 | ||
2491 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2491 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2492 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2492 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2493 | 2493 | ||
2494 | //QPtrList<Addressee> el = local->rawAddressees(); | 2494 | //QPtrList<Addressee> el = local->rawAddressees(); |
2495 | Addressee addresseeR; | 2495 | Addressee addresseeR; |
2496 | QString uid; | 2496 | QString uid; |
2497 | int take; | 2497 | int take; |
2498 | Addressee addresseeL; | 2498 | Addressee addresseeL; |
2499 | Addressee addresseeRSync; | 2499 | Addressee addresseeRSync; |
2500 | Addressee addresseeLSync; | 2500 | Addressee addresseeLSync; |
2501 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2501 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2502 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2502 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2503 | bool fullDateRange = false; | 2503 | bool fullDateRange = false; |
2504 | local->resetTempSyncStat(); | 2504 | local->resetTempSyncStat(); |
2505 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2505 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2506 | QDateTime modifiedCalendar = mLastAddressbookSync;; | 2506 | QDateTime modifiedCalendar = mLastAddressbookSync;; |
2507 | addresseeLSync = getLastSyncAddressee(); | 2507 | addresseeLSync = getLastSyncAddressee(); |
2508 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2508 | qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2509 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2509 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2510 | if ( !addresseeR.isEmpty() ) { | 2510 | if ( !addresseeR.isEmpty() ) { |
2511 | addresseeRSync = addresseeR; | 2511 | addresseeRSync = addresseeR; |
2512 | remote->removeAddressee(addresseeR ); | 2512 | remote->removeAddressee(addresseeR ); |
2513 | 2513 | ||
2514 | } else { | 2514 | } else { |
2515 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2515 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2516 | addresseeRSync = addresseeLSync ; | 2516 | addresseeRSync = addresseeLSync ; |
2517 | } else { | 2517 | } else { |
2518 | qDebug("FULLDATE 1"); | 2518 | qDebug("FULLDATE 1"); |
2519 | fullDateRange = true; | 2519 | fullDateRange = true; |
2520 | Addressee newAdd; | 2520 | Addressee newAdd; |
2521 | addresseeRSync = newAdd; | 2521 | addresseeRSync = newAdd; |
2522 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2522 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2523 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2523 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2524 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2524 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2525 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2525 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2526 | } | 2526 | } |
2527 | } | 2527 | } |
2528 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2528 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2529 | qDebug("FULLDATE 2"); | 2529 | qDebug("FULLDATE 2"); |
2530 | fullDateRange = true; | 2530 | fullDateRange = true; |
2531 | } | 2531 | } |
2532 | if ( ! fullDateRange ) { | 2532 | if ( ! fullDateRange ) { |
2533 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 2533 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2534 | 2534 | ||
2535 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 2535 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2536 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 2536 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2537 | fullDateRange = true; | 2537 | fullDateRange = true; |
2538 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2538 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2539 | } | 2539 | } |
2540 | } | 2540 | } |
2541 | // fullDateRange = true; // debug only! | 2541 | // fullDateRange = true; // debug only! |
2542 | if ( fullDateRange ) | 2542 | if ( fullDateRange ) |
2543 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2543 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2544 | else | 2544 | else |
2545 | mLastAddressbookSync = addresseeLSync.revision(); | 2545 | mLastAddressbookSync = addresseeLSync.revision(); |
2546 | // for resyncing if own file has changed | 2546 | // for resyncing if own file has changed |
2547 | // PENDING fixme later when implemented | 2547 | // PENDING fixme later when implemented |
2548 | #if 0 | 2548 | #if 0 |
2549 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 2549 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
2550 | mLastAddressbookSync = loadedFileVersion; | 2550 | mLastAddressbookSync = loadedFileVersion; |
2551 | qDebug("setting mLastAddressbookSync "); | 2551 | qDebug("setting mLastAddressbookSync "); |
2552 | } | 2552 | } |
2553 | #endif | 2553 | #endif |
2554 | 2554 | ||
2555 | //qDebug("*************************** "); | 2555 | //qDebug("*************************** "); |
2556 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 2556 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
2557 | QStringList er = remote->uidList(); | 2557 | QStringList er = remote->uidList(); |
2558 | Addressee inR ;//= er.first(); | 2558 | Addressee inR ;//= er.first(); |
2559 | Addressee inL; | 2559 | Addressee inL; |
2560 | 2560 | ||
2561 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 2561 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
2562 | 2562 | ||
2563 | int modulo = (er.count()/10)+1; | 2563 | int modulo = (er.count()/10)+1; |
2564 | int incCounter = 0; | 2564 | int incCounter = 0; |
2565 | while ( incCounter < er.count()) { | 2565 | while ( incCounter < er.count()) { |
2566 | if (syncManager->isProgressBarCanceled()) | 2566 | if (syncManager->isProgressBarCanceled()) |
2567 | return false; | 2567 | return false; |
2568 | if ( incCounter % modulo == 0 ) | 2568 | if ( incCounter % modulo == 0 ) |
2569 | syncManager->showProgressBar(incCounter); | 2569 | syncManager->showProgressBar(incCounter); |
2570 | 2570 | ||
2571 | uid = er[ incCounter ]; | 2571 | uid = er[ incCounter ]; |
2572 | bool skipIncidence = false; | 2572 | bool skipIncidence = false; |
2573 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 2573 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
2574 | skipIncidence = true; | 2574 | skipIncidence = true; |
2575 | QString idS,OidS; | 2575 | QString idS,OidS; |
2576 | qApp->processEvents(); | 2576 | qApp->processEvents(); |
2577 | if ( !skipIncidence ) { | 2577 | if ( !skipIncidence ) { |
2578 | inL = local->findByUid( uid ); | 2578 | inL = local->findByUid( uid ); |
2579 | inR = remote->findByUid( uid ); | 2579 | inR = remote->findByUid( uid ); |
2580 | //inL.setResource( 0 ); | 2580 | //inL.setResource( 0 ); |
2581 | //inR.setResource( 0 ); | 2581 | //inR.setResource( 0 ); |
2582 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 2582 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
2583 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 2583 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
2584 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { | 2584 | if ( take = takeAddressee( &inL, &inR, mode, fullDateRange ) ) { |
2585 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 2585 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
2586 | if ( take == 3 ) | 2586 | if ( take == 3 ) |
2587 | return false; | 2587 | return false; |
2588 | if ( take == 1 ) {// take local | 2588 | if ( take == 1 ) {// take local |
2589 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2589 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2590 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 2590 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
2591 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 2591 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
2592 | local->insertAddressee( inL, false ); | 2592 | local->insertAddressee( inL, false ); |
2593 | idS = inR.externalUID(); | 2593 | idS = inR.externalUID(); |
2594 | OidS = inR.originalExternalUID(); | 2594 | OidS = inR.originalExternalUID(); |
2595 | } | 2595 | } |
2596 | else | 2596 | else |
2597 | idS = inR.IDStr(); | 2597 | idS = inR.IDStr(); |
2598 | remote->removeAddressee( inR ); | 2598 | remote->removeAddressee( inR ); |
2599 | inR = inL; | 2599 | inR = inL; |
2600 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 2600 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
2601 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2601 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2602 | inR.setOriginalExternalUID( OidS ); | 2602 | inR.setOriginalExternalUID( OidS ); |
2603 | inR.setExternalUID( idS ); | 2603 | inR.setExternalUID( idS ); |
2604 | } else { | 2604 | } else { |
2605 | inR.setIDStr( idS ); | 2605 | inR.setIDStr( idS ); |
2606 | } | 2606 | } |
2607 | inR.setResource( 0 ); | 2607 | inR.setResource( 0 ); |
2608 | remote->insertAddressee( inR , false); | 2608 | remote->insertAddressee( inR , false); |
2609 | ++changedRemote; | 2609 | ++changedRemote; |
2610 | } else { // take == 2 take remote | 2610 | } else { // take == 2 take remote |
2611 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2611 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2612 | if ( inR.revision().date().year() < 2004 ) | 2612 | if ( inR.revision().date().year() < 2004 ) |
2613 | inR.setRevision( modifiedCalendar ); | 2613 | inR.setRevision( modifiedCalendar ); |
2614 | } | 2614 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index e3dad94..fbfcd20 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -43,1537 +43,1537 @@ | |||
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "klocale.h" | 60 | #include "klocale.h" |
61 | #include "kconfig.h" | 61 | #include "kconfig.h" |
62 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
63 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
64 | 64 | ||
65 | using namespace KCal; | 65 | using namespace KCal; |
66 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #else | 68 | #else |
69 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
70 | #endif | 70 | #endif |
71 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
72 | 72 | ||
73 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
77 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
78 | { | 78 | { |
79 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
80 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
81 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
82 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
83 | QLabel *lab; | 83 | QLabel *lab; |
84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
85 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
86 | QHBox* temphb; | 86 | QHBox* temphb; |
87 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
88 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
89 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public: | 119 | public: |
120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
121 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
122 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mClosed = false; | 133 | mClosed = false; |
134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
135 | QString confFile = locateLocal("config","korganizerrc"); | 135 | QString confFile = locateLocal("config","korganizerrc"); |
136 | QFileInfo finf ( confFile ); | 136 | QFileInfo finf ( confFile ); |
137 | bool showWarning = !finf.exists(); | 137 | bool showWarning = !finf.exists(); |
138 | setIcon(SmallIcon( "ko24" ) ); | 138 | setIcon(SmallIcon( "ko24" ) ); |
139 | mBlockAtStartup = true; | 139 | mBlockAtStartup = true; |
140 | mFlagKeyPressed = false; | 140 | mFlagKeyPressed = false; |
141 | setCaption("KOrganizer/Pi"); | 141 | setCaption("KOrganizer/Pi"); |
142 | KOPrefs *p = KOPrefs::instance(); | 142 | KOPrefs *p = KOPrefs::instance(); |
143 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 143 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
144 | if ( p->mHourSize > 18 ) | 144 | if ( p->mHourSize > 18 ) |
145 | p->mHourSize = 18; | 145 | p->mHourSize = 18; |
146 | QMainWindow::ToolBarDock tbd; | 146 | QMainWindow::ToolBarDock tbd; |
147 | if ( p->mToolBarHor ) { | 147 | if ( p->mToolBarHor ) { |
148 | if ( p->mToolBarUp ) | 148 | if ( p->mToolBarUp ) |
149 | tbd = Bottom; | 149 | tbd = Bottom; |
150 | else | 150 | else |
151 | tbd = Top; | 151 | tbd = Top; |
152 | } | 152 | } |
153 | else { | 153 | else { |
154 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
155 | tbd = Right; | 155 | tbd = Right; |
156 | else | 156 | else |
157 | tbd = Left; | 157 | tbd = Left; |
158 | } | 158 | } |
159 | if ( KOPrefs::instance()->mUseAppColors ) | 159 | if ( KOPrefs::instance()->mUseAppColors ) |
160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
161 | globalFlagBlockStartup = 1; | 161 | globalFlagBlockStartup = 1; |
162 | iconToolBar = new QPEToolBar( this ); | 162 | iconToolBar = new QPEToolBar( this ); |
163 | addToolBar (iconToolBar , tbd ); | 163 | addToolBar (iconToolBar , tbd ); |
164 | mCalendarModifiedFlag = false; | 164 | mCalendarModifiedFlag = false; |
165 | 165 | ||
166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
167 | splash->setAlignment ( AlignCenter ); | 167 | splash->setAlignment ( AlignCenter ); |
168 | setCentralWidget( splash ); | 168 | setCentralWidget( splash ); |
169 | #ifndef DESKTOP_VERSION | 169 | #ifndef DESKTOP_VERSION |
170 | showMaximized(); | 170 | showMaximized(); |
171 | #endif | 171 | #endif |
172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
173 | setDefaultPreferences(); | 173 | setDefaultPreferences(); |
174 | mCalendar = new CalendarLocal(); | 174 | mCalendar = new CalendarLocal(); |
175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
176 | mView->hide(); | 176 | mView->hide(); |
177 | //mView->resize(splash->size() ); | 177 | //mView->resize(splash->size() ); |
178 | initActions(); | 178 | initActions(); |
179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
180 | mSyncManager->setBlockSave(false); | 180 | mSyncManager->setBlockSave(false); |
181 | mView->setSyncManager(mSyncManager); | 181 | mView->setSyncManager(mSyncManager); |
182 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
183 | iconToolBar->show(); | 183 | iconToolBar->show(); |
184 | qApp->processEvents(); | 184 | qApp->processEvents(); |
185 | #endif | 185 | #endif |
186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
187 | int vh = height() ; | 187 | int vh = height() ; |
188 | int vw = width(); | 188 | int vw = width(); |
189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
191 | vh -= iconToolBar->height(); | 191 | vh -= iconToolBar->height(); |
192 | } else { | 192 | } else { |
193 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
194 | } | 194 | } |
195 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
196 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
198 | mView->readSettings(); | 198 | mView->readSettings(); |
199 | bool newFile = false; | 199 | bool newFile = false; |
200 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
201 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
203 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
205 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
206 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
207 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
208 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
209 | qApp->processEvents(); | 209 | qApp->processEvents(); |
210 | } else { | 210 | } else { |
211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
220 | newFile = true; | 220 | newFile = true; |
221 | } | 221 | } |
222 | 222 | ||
223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KOPrefs::instance()->mLanguageChanged ) { | 228 | if ( KOPrefs::instance()->mLanguageChanged ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | KOPrefs::instance()->mLanguageChanged = false; | 231 | KOPrefs::instance()->mLanguageChanged = false; |
232 | } | 232 | } |
233 | processIncidenceSelection( 0 ); | 233 | processIncidenceSelection( 0 ); |
234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 234 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
235 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 235 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 236 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
237 | SLOT( slotModifiedChanged( bool ) ) ); | 237 | SLOT( slotModifiedChanged( bool ) ) ); |
238 | 238 | ||
239 | 239 | ||
240 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 240 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
241 | SLOT( disableBR(bool) ) ); | 241 | SLOT( disableBR(bool) ) ); |
242 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 242 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
243 | mView->setModified( false ); | 243 | mView->setModified( false ); |
244 | mBlockAtStartup = false; | 244 | mBlockAtStartup = false; |
245 | mView->setModified( false ); | 245 | mView->setModified( false ); |
246 | setCentralWidget( mView ); | 246 | setCentralWidget( mView ); |
247 | globalFlagBlockStartup = 0; | 247 | globalFlagBlockStartup = 0; |
248 | mView->show(); | 248 | mView->show(); |
249 | delete splash; | 249 | delete splash; |
250 | if ( newFile ) | 250 | if ( newFile ) |
251 | mView->updateConfig(); | 251 | mView->updateConfig(); |
252 | // qApp->processEvents(); | 252 | // qApp->processEvents(); |
253 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 253 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
254 | //fillSyncMenu(); | 254 | //fillSyncMenu(); |
255 | 255 | ||
256 | 256 | ||
257 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 257 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
258 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 258 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
259 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 259 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
260 | mSyncManager->setDefaultFileName( defaultFileName()); | 260 | mSyncManager->setDefaultFileName( defaultFileName()); |
261 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 261 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
262 | mSyncManager->fillSyncMenu(); | 262 | mSyncManager->fillSyncMenu(); |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 266 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
267 | if ( showWarning ) { | 267 | if ( showWarning ) { |
268 | KMessageBox::information( this, | 268 | KMessageBox::information( this, |
269 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 269 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
270 | qApp->processEvents(); | 270 | qApp->processEvents(); |
271 | mView->dialogManager()->showSyncOptions(); | 271 | mView->dialogManager()->showSyncOptions(); |
272 | } | 272 | } |
273 | 273 | ||
274 | //US listen for result adressed from Ka/Pi | 274 | //US listen for result adressed from Ka/Pi |
275 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
276 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 276 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
277 | #endif | 277 | #endif |
278 | #ifndef DESKTOP_VERSION | 278 | #ifndef DESKTOP_VERSION |
279 | infrared = 0; | 279 | infrared = 0; |
280 | #endif | 280 | #endif |
281 | 281 | ||
282 | mBRdisabled = false; | 282 | mBRdisabled = false; |
283 | toggleBeamReceive(); | 283 | toggleBeamReceive(); |
284 | } | 284 | } |
285 | MainWindow::~MainWindow() | 285 | MainWindow::~MainWindow() |
286 | { | 286 | { |
287 | //qDebug("MainWindow::~MainWindow() "); | 287 | //qDebug("MainWindow::~MainWindow() "); |
288 | //save toolbar location | 288 | //save toolbar location |
289 | delete mCalendar; | 289 | delete mCalendar; |
290 | delete mSyncManager; | 290 | delete mSyncManager; |
291 | #ifndef DESKTOP_VERSION | 291 | #ifndef DESKTOP_VERSION |
292 | if ( infrared ) | 292 | if ( infrared ) |
293 | delete infrared; | 293 | delete infrared; |
294 | #endif | 294 | #endif |
295 | 295 | ||
296 | 296 | ||
297 | } | 297 | } |
298 | 298 | ||
299 | void MainWindow::disableBR(bool b) | 299 | void MainWindow::disableBR(bool b) |
300 | { | 300 | { |
301 | #ifndef DESKTOP_VERSION | 301 | #ifndef DESKTOP_VERSION |
302 | if ( b ) { | 302 | if ( b ) { |
303 | if ( infrared ) { | 303 | if ( infrared ) { |
304 | toggleBeamReceive(); | 304 | toggleBeamReceive(); |
305 | mBRdisabled = true; | 305 | mBRdisabled = true; |
306 | } | 306 | } |
307 | mBRdisabled = true; | 307 | mBRdisabled = true; |
308 | } else { | 308 | } else { |
309 | if ( mBRdisabled ) { | 309 | if ( mBRdisabled ) { |
310 | mBRdisabled = false; | 310 | mBRdisabled = false; |
311 | //makes no sense,because other cal ap is probably running | 311 | //makes no sense,because other cal ap is probably running |
312 | // toggleBeamReceive(); | 312 | // toggleBeamReceive(); |
313 | } | 313 | } |
314 | } | 314 | } |
315 | #endif | 315 | #endif |
316 | 316 | ||
317 | } | 317 | } |
318 | bool MainWindow::beamReceiveEnabled() | 318 | bool MainWindow::beamReceiveEnabled() |
319 | { | 319 | { |
320 | #ifndef DESKTOP_VERSION | 320 | #ifndef DESKTOP_VERSION |
321 | return ( infrared != 0 ); | 321 | return ( infrared != 0 ); |
322 | #endif | 322 | #endif |
323 | return false; | 323 | return false; |
324 | } | 324 | } |
325 | 325 | ||
326 | void MainWindow::toggleBeamReceive() | 326 | void MainWindow::toggleBeamReceive() |
327 | { | 327 | { |
328 | if ( mBRdisabled ) | 328 | if ( mBRdisabled ) |
329 | return; | 329 | return; |
330 | #ifndef DESKTOP_VERSION | 330 | #ifndef DESKTOP_VERSION |
331 | if ( infrared ) { | 331 | if ( infrared ) { |
332 | qDebug("disable BeamReceive "); | 332 | qDebug("disable BeamReceive "); |
333 | delete infrared; | 333 | delete infrared; |
334 | infrared = 0; | 334 | infrared = 0; |
335 | brAction->setOn(false); | 335 | brAction->setOn(false); |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | qDebug("enable BeamReceive "); | 338 | qDebug("enable BeamReceive "); |
339 | brAction->setOn(true); | 339 | brAction->setOn(true); |
340 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 340 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
341 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 341 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
342 | #endif | 342 | #endif |
343 | } | 343 | } |
344 | void MainWindow::showMaximized () | 344 | void MainWindow::showMaximized () |
345 | { | 345 | { |
346 | #ifndef DESKTOP_VERSION | 346 | #ifndef DESKTOP_VERSION |
347 | if ( ! globalFlagBlockStartup ) | 347 | if ( ! globalFlagBlockStartup ) |
348 | if ( mClosed ) | 348 | if ( mClosed ) |
349 | mView->goToday(); | 349 | mView->goToday(); |
350 | #endif | 350 | #endif |
351 | QWidget::showMaximized () ; | 351 | QWidget::showMaximized () ; |
352 | mClosed = false; | 352 | mClosed = false; |
353 | } | 353 | } |
354 | void MainWindow::closeEvent( QCloseEvent* ce ) | 354 | void MainWindow::closeEvent( QCloseEvent* ce ) |
355 | { | 355 | { |
356 | 356 | ||
357 | 357 | ||
358 | 358 | ||
359 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 359 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
360 | saveOnClose(); | 360 | saveOnClose(); |
361 | mClosed = true; | 361 | mClosed = true; |
362 | ce->accept(); | 362 | ce->accept(); |
363 | return; | 363 | return; |
364 | 364 | ||
365 | } | 365 | } |
366 | 366 | ||
367 | switch( QMessageBox::information( this, "KO/Pi", | 367 | switch( QMessageBox::information( this, "KO/Pi", |
368 | i18n("Do you really want\nto close KO/Pi?"), | 368 | i18n("Do you really want\nto close KO/Pi?"), |
369 | i18n("Close"), i18n("No"), | 369 | i18n("Close"), i18n("No"), |
370 | 0, 0 ) ) { | 370 | 0, 0 ) ) { |
371 | case 0: | 371 | case 0: |
372 | saveOnClose(); | 372 | saveOnClose(); |
373 | mClosed = true; | 373 | mClosed = true; |
374 | ce->accept(); | 374 | ce->accept(); |
375 | break; | 375 | break; |
376 | case 1: | 376 | case 1: |
377 | ce->ignore(); | 377 | ce->ignore(); |
378 | break; | 378 | break; |
379 | case 2: | 379 | case 2: |
380 | 380 | ||
381 | default: | 381 | default: |
382 | break; | 382 | break; |
383 | } | 383 | } |
384 | 384 | ||
385 | 385 | ||
386 | } | 386 | } |
387 | 387 | ||
388 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 388 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
389 | { | 389 | { |
390 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
391 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 391 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
392 | //QString datamess; | 392 | //QString datamess; |
393 | //qDebug("message "); | 393 | //qDebug("message "); |
394 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 394 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
395 | 395 | ||
396 | if ( cmsg == "setDocument(QString)" ) { | 396 | if ( cmsg == "setDocument(QString)" ) { |
397 | QDataStream stream( data, IO_ReadOnly ); | 397 | QDataStream stream( data, IO_ReadOnly ); |
398 | QString fileName; | 398 | QString fileName; |
399 | stream >> fileName; | 399 | stream >> fileName; |
400 | //qDebug("filename %s ", fileName.latin1()); | 400 | //qDebug("filename %s ", fileName.latin1()); |
401 | showMaximized(); | 401 | showMaximized(); |
402 | raise(); | 402 | raise(); |
403 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 403 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
404 | mSyncManager->slotSyncMenu( 1002 ); | 404 | mSyncManager->slotSyncMenu( 1002 ); |
405 | return; | 405 | return; |
406 | } | 406 | } |
407 | 407 | ||
408 | if ( cmsg == "-writeFile" ) { | 408 | if ( cmsg == "-writeFile" ) { |
409 | // I made from the "-writeFile" an "-writeAlarm" | 409 | // I made from the "-writeFile" an "-writeAlarm" |
410 | mView->viewManager()->showWhatsNextView(); | 410 | mView->viewManager()->showWhatsNextView(); |
411 | mCalendar->checkAlarmForIncidence( 0, true); | 411 | mCalendar->checkAlarmForIncidence( 0, true); |
412 | showMaximized(); | 412 | showMaximized(); |
413 | raise(); | 413 | raise(); |
414 | return; | 414 | return; |
415 | 415 | ||
416 | } | 416 | } |
417 | if ( cmsg == "-writeFileSilent" ) { | 417 | if ( cmsg == "-writeFileSilent" ) { |
418 | // I made from the "-writeFile" an "-writeAlarm" | 418 | // I made from the "-writeFile" an "-writeAlarm" |
419 | // mView->viewManager()->showWhatsNextView(); | 419 | // mView->viewManager()->showWhatsNextView(); |
420 | mCalendar->checkAlarmForIncidence( 0, true); | 420 | mCalendar->checkAlarmForIncidence( 0, true); |
421 | //showMaximized(); | 421 | //showMaximized(); |
422 | //raise(); | 422 | //raise(); |
423 | hide(); | 423 | hide(); |
424 | return; | 424 | return; |
425 | } | 425 | } |
426 | if ( cmsg == "-newCountdown" ) { | 426 | if ( cmsg == "-newCountdown" ) { |
427 | qDebug("newCountdown "); | 427 | qDebug("newCountdown "); |
428 | 428 | ||
429 | } | 429 | } |
430 | QString msg ; | 430 | QString msg ; |
431 | QString allmsg = cmsg; | 431 | QString allmsg = cmsg; |
432 | while ( allmsg.length() > 0 ) { | 432 | while ( allmsg.length() > 0 ) { |
433 | int nextC = allmsg.find( "-", 1 ); | 433 | int nextC = allmsg.find( "-", 1 ); |
434 | if ( nextC == -1 ) { | 434 | if ( nextC == -1 ) { |
435 | msg = allmsg; | 435 | msg = allmsg; |
436 | allmsg = ""; | 436 | allmsg = ""; |
437 | } else{ | 437 | } else{ |
438 | msg = allmsg.left( nextC ); | 438 | msg = allmsg.left( nextC ); |
439 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 439 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
440 | } | 440 | } |
441 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 441 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
442 | if ( msg == "-newEvent" ) { | 442 | if ( msg == "-newEvent" ) { |
443 | mView->newEvent(); | 443 | mView->newEvent(); |
444 | } | 444 | } |
445 | if ( msg == "-newTodo" ) { | 445 | if ( msg == "-newTodo" ) { |
446 | mView->newTodo(); | 446 | mView->newTodo(); |
447 | 447 | ||
448 | } | 448 | } |
449 | if ( msg == "-showWN" ) { | 449 | if ( msg == "-showWN" ) { |
450 | mView->viewManager()->showWhatsNextView(); | 450 | mView->viewManager()->showWhatsNextView(); |
451 | } | 451 | } |
452 | if ( msg == "-showTodo" ) { | 452 | if ( msg == "-showTodo" ) { |
453 | mView->viewManager()->showTodoView(); | 453 | mView->viewManager()->showTodoView(); |
454 | } | 454 | } |
455 | if ( msg == "-showList" ) { | 455 | if ( msg == "-showList" ) { |
456 | mView->viewManager()->showListView(); | 456 | mView->viewManager()->showListView(); |
457 | } | 457 | } |
458 | else if ( msg == "-showDay" ) { | 458 | else if ( msg == "-showDay" ) { |
459 | mView->viewManager()->showDayView(); | 459 | mView->viewManager()->showDayView(); |
460 | } | 460 | } |
461 | else if ( msg == "-showWWeek" ) { | 461 | else if ( msg == "-showWWeek" ) { |
462 | mView->viewManager()->showWorkWeekView(); | 462 | mView->viewManager()->showWorkWeekView(); |
463 | } | 463 | } |
464 | else if ( msg == "-ringSync" ) { | 464 | else if ( msg == "-ringSync" ) { |
465 | mSyncManager->multiSync( false ); | 465 | mSyncManager->multiSync( false ); |
466 | } | 466 | } |
467 | else if ( msg == "-showWeek" ) { | 467 | else if ( msg == "-showWeek" ) { |
468 | mView->viewManager()->showWeekView(); | 468 | mView->viewManager()->showWeekView(); |
469 | } | 469 | } |
470 | else if ( msg == "-showTodo" ) { | 470 | else if ( msg == "-showTodo" ) { |
471 | mView->viewManager()->showTodoView(); | 471 | mView->viewManager()->showTodoView(); |
472 | } | 472 | } |
473 | else if ( msg == "-showJournal" ) { | 473 | else if ( msg == "-showJournal" ) { |
474 | mView->dateNavigator()->selectDates( 1 ); | 474 | mView->dateNavigator()->selectDates( 1 ); |
475 | mView->dateNavigator()->selectToday(); | 475 | mView->dateNavigator()->selectToday(); |
476 | mView->viewManager()->showJournalView(); | 476 | mView->viewManager()->showJournalView(); |
477 | } | 477 | } |
478 | else if ( msg == "-showKO" ) { | 478 | else if ( msg == "-showKO" ) { |
479 | mView->viewManager()->showNextXView(); | 479 | mView->viewManager()->showNextXView(); |
480 | } | 480 | } |
481 | else if ( msg == "-showWNext" || msg == "nextView()" ) { | 481 | else if ( msg == "-showWNext" || msg == "nextView()" ) { |
482 | mView->viewManager()->showWhatsNextView(); | 482 | mView->viewManager()->showWhatsNextView(); |
483 | } | 483 | } |
484 | else if ( msg == "-showNextXView" ) { | 484 | else if ( msg == "-showNextXView" ) { |
485 | mView->viewManager()->showNextXView(); | 485 | mView->viewManager()->showNextXView(); |
486 | } | 486 | } |
487 | 487 | ||
488 | 488 | ||
489 | } | 489 | } |
490 | 490 | ||
491 | showMaximized(); | 491 | showMaximized(); |
492 | raise(); | 492 | raise(); |
493 | } | 493 | } |
494 | 494 | ||
495 | QPixmap MainWindow::loadPixmap( QString name ) | 495 | QPixmap MainWindow::loadPixmap( QString name ) |
496 | { | 496 | { |
497 | return SmallIcon( name ); | 497 | return SmallIcon( name ); |
498 | 498 | ||
499 | } | 499 | } |
500 | void MainWindow::initActions() | 500 | void MainWindow::initActions() |
501 | { | 501 | { |
502 | //KOPrefs::instance()->mShowFullMenu | 502 | //KOPrefs::instance()->mShowFullMenu |
503 | iconToolBar->clear(); | 503 | iconToolBar->clear(); |
504 | KOPrefs *p = KOPrefs::instance(); | 504 | KOPrefs *p = KOPrefs::instance(); |
505 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 505 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
506 | 506 | ||
507 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 507 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
508 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 508 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
509 | QPopupMenu *importMenu = new QPopupMenu( this ); | 509 | QPopupMenu *importMenu = new QPopupMenu( this ); |
510 | selectFilterMenu = new QPopupMenu( this ); | 510 | selectFilterMenu = new QPopupMenu( this ); |
511 | selectFilterMenu->setCheckable( true ); | 511 | selectFilterMenu->setCheckable( true ); |
512 | syncMenu = new QPopupMenu( this ); | 512 | syncMenu = new QPopupMenu( this ); |
513 | configureAgendaMenu = new QPopupMenu( this ); | 513 | configureAgendaMenu = new QPopupMenu( this ); |
514 | configureToolBarMenu = new QPopupMenu( this ); | 514 | configureToolBarMenu = new QPopupMenu( this ); |
515 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 515 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
516 | if ( KOPrefs::instance()->mShowFullMenu ) { | 516 | if ( KOPrefs::instance()->mShowFullMenu ) { |
517 | QMenuBar *menuBar1; | 517 | QMenuBar *menuBar1; |
518 | menuBar1 = menuBar(); | 518 | menuBar1 = menuBar(); |
519 | menuBar1->insertItem( i18n("File"), importMenu ); | 519 | menuBar1->insertItem( i18n("File"), importMenu ); |
520 | menuBar1->insertItem( i18n("View"), viewMenu ); | 520 | menuBar1->insertItem( i18n("View"), viewMenu ); |
521 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 521 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
522 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 522 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
523 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 523 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
524 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 524 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
525 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 525 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
526 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 526 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
527 | } else { | 527 | } else { |
528 | QPEMenuBar *menuBar1; | 528 | QPEMenuBar *menuBar1; |
529 | menuBar1 = new QPEMenuBar( iconToolBar ); | 529 | menuBar1 = new QPEMenuBar( iconToolBar ); |
530 | QPopupMenu *menuBar = new QPopupMenu( this ); | 530 | QPopupMenu *menuBar = new QPopupMenu( this ); |
531 | menuBar1->insertItem( i18n("ME"), menuBar); | 531 | menuBar1->insertItem( i18n("ME"), menuBar); |
532 | menuBar->insertItem( i18n("File"), importMenu ); | 532 | menuBar->insertItem( i18n("File"), importMenu ); |
533 | menuBar->insertItem( i18n("View"), viewMenu ); | 533 | menuBar->insertItem( i18n("View"), viewMenu ); |
534 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 534 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
535 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 535 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
536 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 536 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
537 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 537 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
538 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 538 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
539 | menuBar->insertItem( i18n("Help"), helpMenu ); | 539 | menuBar->insertItem( i18n("Help"), helpMenu ); |
540 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 540 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
541 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 541 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
542 | } | 542 | } |
543 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 543 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
544 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | 544 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); |
545 | 545 | ||
546 | // ****************** | 546 | // ****************** |
547 | QAction *action; | 547 | QAction *action; |
548 | QIconSet icon; | 548 | QIconSet icon; |
549 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 549 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
550 | configureToolBarMenu->setCheckable( true ); | 550 | configureToolBarMenu->setCheckable( true ); |
551 | 551 | ||
552 | QString pathString = ""; | 552 | QString pathString = ""; |
553 | if ( !p->mToolBarMiniIcons ) { | 553 | if ( !p->mToolBarMiniIcons ) { |
554 | if ( QApplication::desktop()->width() < 480 ) | 554 | if ( QApplication::desktop()->width() < 480 ) |
555 | pathString += "icons16/"; | 555 | pathString += "icons16/"; |
556 | } else | 556 | } else |
557 | pathString += "iconsmini/"; | 557 | pathString += "iconsmini/"; |
558 | configureAgendaMenu->setCheckable( true ); | 558 | configureAgendaMenu->setCheckable( true ); |
559 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); | 559 | configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); |
560 | configureAgendaMenu->insertSeparator(); | 560 | configureAgendaMenu->insertSeparator(); |
561 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); | 561 | configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); |
562 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); | 562 | configureAgendaMenu->insertItem(i18n("Small"), 6 ); |
563 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); | 563 | configureAgendaMenu->insertItem(i18n("Medium"), 8 ); |
564 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); | 564 | configureAgendaMenu->insertItem(i18n("Normal"), 10 ); |
565 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); | 565 | configureAgendaMenu->insertItem(i18n("Large"), 12 ); |
566 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); | 566 | configureAgendaMenu->insertItem(i18n("Big"), 14 ); |
567 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); | 567 | configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); |
568 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); | 568 | configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); |
569 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 569 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
570 | 570 | ||
571 | icon = loadPixmap( pathString + "configure" ); | 571 | icon = loadPixmap( pathString + "configure" ); |
572 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 572 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
573 | action->addTo( actionMenu ); | 573 | action->addTo( actionMenu ); |
574 | connect( action, SIGNAL( activated() ), | 574 | connect( action, SIGNAL( activated() ), |
575 | mView, SLOT( edit_options() ) ); | 575 | mView, SLOT( edit_options() ) ); |
576 | actionMenu->insertSeparator(); | 576 | actionMenu->insertSeparator(); |
577 | icon = loadPixmap( pathString + "newevent" ); | 577 | icon = loadPixmap( pathString + "newevent" ); |
578 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 578 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
579 | configureToolBarMenu->insertSeparator(); | 579 | configureToolBarMenu->insertSeparator(); |
580 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 580 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
581 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 581 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
582 | ne_action->addTo( actionMenu ); | 582 | ne_action->addTo( actionMenu ); |
583 | connect( ne_action, SIGNAL( activated() ), | 583 | connect( ne_action, SIGNAL( activated() ), |
584 | mView, SLOT( newEvent() ) ); | 584 | mView, SLOT( newEvent() ) ); |
585 | icon = loadPixmap( pathString + "newtodo" ); | 585 | icon = loadPixmap( pathString + "newtodo" ); |
586 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 586 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
587 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 587 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
588 | nt_action->addTo( actionMenu ); | 588 | nt_action->addTo( actionMenu ); |
589 | connect( nt_action, SIGNAL( activated() ), | 589 | connect( nt_action, SIGNAL( activated() ), |
590 | mView, SLOT( newTodo() ) ); | 590 | mView, SLOT( newTodo() ) ); |
591 | icon = loadPixmap( pathString + "navi" ); | 591 | icon = loadPixmap( pathString + "navi" ); |
592 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 592 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
593 | action->addTo( viewMenu ); | 593 | action->addTo( viewMenu ); |
594 | connect( action, SIGNAL( activated() ), | 594 | connect( action, SIGNAL( activated() ), |
595 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 595 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
596 | icon = loadPixmap( pathString + "filter" ); | 596 | icon = loadPixmap( pathString + "filter" ); |
597 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 597 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
598 | action->addTo( viewMenu ); | 598 | action->addTo( viewMenu ); |
599 | connect( action, SIGNAL( activated() ), | 599 | connect( action, SIGNAL( activated() ), |
600 | mView, SLOT( toggleFilter() ) ); | 600 | mView, SLOT( toggleFilter() ) ); |
601 | 601 | ||
602 | 602 | ||
603 | viewMenu->insertSeparator(); | 603 | viewMenu->insertSeparator(); |
604 | icon = loadPixmap( pathString + "picker" ); | 604 | icon = loadPixmap( pathString + "picker" ); |
605 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 605 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
606 | action->addTo( viewMenu ); | 606 | action->addTo( viewMenu ); |
607 | connect( action, SIGNAL( activated() ), | 607 | connect( action, SIGNAL( activated() ), |
608 | mView, SLOT( showDatePicker() ) ); | 608 | mView, SLOT( showDatePicker() ) ); |
609 | action->addTo( iconToolBar ); | 609 | action->addTo( iconToolBar ); |
610 | viewMenu->insertSeparator(); | 610 | viewMenu->insertSeparator(); |
611 | icon = loadPixmap( pathString + "list" ); | 611 | icon = loadPixmap( pathString + "list" ); |
612 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 612 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
613 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 613 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
614 | showlist_action->addTo( viewMenu ); | 614 | showlist_action->addTo( viewMenu ); |
615 | connect( showlist_action, SIGNAL( activated() ), | 615 | connect( showlist_action, SIGNAL( activated() ), |
616 | mView->viewManager(), SLOT( showListView() ) ); | 616 | mView->viewManager(), SLOT( showListView() ) ); |
617 | 617 | ||
618 | 618 | ||
619 | icon = loadPixmap( pathString + "day" ); | 619 | icon = loadPixmap( pathString + "day" ); |
620 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 620 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
621 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 621 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
622 | day1_action->addTo( viewMenu ); | 622 | day1_action->addTo( viewMenu ); |
623 | // action->addTo( toolBar ); | 623 | // action->addTo( toolBar ); |
624 | connect( day1_action, SIGNAL( activated() ), | 624 | connect( day1_action, SIGNAL( activated() ), |
625 | mView->viewManager(), SLOT( showDayView() ) ); | 625 | mView->viewManager(), SLOT( showDayView() ) ); |
626 | 626 | ||
627 | icon = loadPixmap( pathString + "workweek" ); | 627 | icon = loadPixmap( pathString + "workweek" ); |
628 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 628 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
629 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 629 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
630 | day5_action->addTo( viewMenu ); | 630 | day5_action->addTo( viewMenu ); |
631 | connect( day5_action, SIGNAL( activated() ), | 631 | connect( day5_action, SIGNAL( activated() ), |
632 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 632 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
633 | 633 | ||
634 | icon = loadPixmap( pathString + "week" ); | 634 | icon = loadPixmap( pathString + "week" ); |
635 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 635 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
636 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 636 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
637 | day7_action->addTo( viewMenu ); | 637 | day7_action->addTo( viewMenu ); |
638 | connect( day7_action, SIGNAL( activated() ), | 638 | connect( day7_action, SIGNAL( activated() ), |
639 | mView->viewManager(), SLOT( showWeekView() ) ); | 639 | mView->viewManager(), SLOT( showWeekView() ) ); |
640 | 640 | ||
641 | icon = loadPixmap( pathString + "month" ); | 641 | icon = loadPixmap( pathString + "month" ); |
642 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 642 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
643 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 643 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
644 | month_action->addTo( viewMenu ); | 644 | month_action->addTo( viewMenu ); |
645 | connect( month_action, SIGNAL( activated() ), | 645 | connect( month_action, SIGNAL( activated() ), |
646 | mView->viewManager(), SLOT( showMonthView() ) ); | 646 | mView->viewManager(), SLOT( showMonthView() ) ); |
647 | 647 | ||
648 | icon = loadPixmap( pathString + "todo" ); | 648 | icon = loadPixmap( pathString + "todo" ); |
649 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 649 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
650 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 650 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
651 | todoview_action->addTo( viewMenu ); | 651 | todoview_action->addTo( viewMenu ); |
652 | connect( todoview_action, SIGNAL( activated() ), | 652 | connect( todoview_action, SIGNAL( activated() ), |
653 | mView->viewManager(), SLOT( showTodoView() ) ); | 653 | mView->viewManager(), SLOT( showTodoView() ) ); |
654 | 654 | ||
655 | icon = loadPixmap( pathString + "journal" ); | 655 | icon = loadPixmap( pathString + "journal" ); |
656 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 656 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
657 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 657 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
658 | viewjournal_action->addTo( viewMenu ); | 658 | viewjournal_action->addTo( viewMenu ); |
659 | connect( viewjournal_action, SIGNAL( activated() ), | 659 | connect( viewjournal_action, SIGNAL( activated() ), |
660 | mView->viewManager(), SLOT( showJournalView() ) ); | 660 | mView->viewManager(), SLOT( showJournalView() ) ); |
661 | 661 | ||
662 | icon = loadPixmap( pathString + "xdays" ); | 662 | icon = loadPixmap( pathString + "xdays" ); |
663 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); | 663 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); |
664 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 664 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
665 | xdays_action->addTo( viewMenu ); | 665 | xdays_action->addTo( viewMenu ); |
666 | connect( xdays_action, SIGNAL( activated() ), | 666 | connect( xdays_action, SIGNAL( activated() ), |
667 | mView->viewManager(), SLOT( showNextXView() ) ); | 667 | mView->viewManager(), SLOT( showNextXView() ) ); |
668 | 668 | ||
669 | icon = loadPixmap( pathString + "whatsnext" ); | 669 | icon = loadPixmap( pathString + "whatsnext" ); |
670 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); | 670 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); |
671 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 671 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
672 | whatsnext_action->addTo( viewMenu ); | 672 | whatsnext_action->addTo( viewMenu ); |
673 | connect( whatsnext_action, SIGNAL( activated() ), | 673 | connect( whatsnext_action, SIGNAL( activated() ), |
674 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 674 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
675 | 675 | ||
676 | #if 0 | 676 | #if 0 |
677 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 677 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
678 | action->addTo( viewMenu ); | 678 | action->addTo( viewMenu ); |
679 | connect( action, SIGNAL( activated() ), | 679 | connect( action, SIGNAL( activated() ), |
680 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 680 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
681 | #endif | 681 | #endif |
682 | 682 | ||
683 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 683 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
684 | this ); | 684 | this ); |
685 | mNewSubTodoAction->addTo( actionMenu ); | 685 | mNewSubTodoAction->addTo( actionMenu ); |
686 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 686 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
687 | mView, SLOT( newSubTodo() ) ); | 687 | mView, SLOT( newSubTodo() ) ); |
688 | 688 | ||
689 | actionMenu->insertSeparator(); | 689 | actionMenu->insertSeparator(); |
690 | 690 | ||
691 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 691 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
692 | mShowAction->addTo( actionMenu ); | 692 | mShowAction->addTo( actionMenu ); |
693 | connect( mShowAction, SIGNAL( activated() ), | 693 | connect( mShowAction, SIGNAL( activated() ), |
694 | mView, SLOT( showIncidence() ) ); | 694 | mView, SLOT( showIncidence() ) ); |
695 | 695 | ||
696 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 696 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
697 | mEditAction->addTo( actionMenu ); | 697 | mEditAction->addTo( actionMenu ); |
698 | connect( mEditAction, SIGNAL( activated() ), | 698 | connect( mEditAction, SIGNAL( activated() ), |
699 | mView, SLOT( editIncidence() ) ); | 699 | mView, SLOT( editIncidence() ) ); |
700 | 700 | ||
701 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 701 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
702 | mDeleteAction->addTo( actionMenu ); | 702 | mDeleteAction->addTo( actionMenu ); |
703 | connect( mDeleteAction, SIGNAL( activated() ), | 703 | connect( mDeleteAction, SIGNAL( activated() ), |
704 | mView, SLOT( deleteIncidence() ) ); | 704 | mView, SLOT( deleteIncidence() ) ); |
705 | 705 | ||
706 | 706 | ||
707 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 707 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
708 | mCloneAction->addTo( actionMenu ); | 708 | mCloneAction->addTo( actionMenu ); |
709 | connect( mCloneAction, SIGNAL( activated() ), | 709 | connect( mCloneAction, SIGNAL( activated() ), |
710 | mView, SLOT( cloneIncidence() ) ); | 710 | mView, SLOT( cloneIncidence() ) ); |
711 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 711 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
712 | mMoveAction->addTo( actionMenu ); | 712 | mMoveAction->addTo( actionMenu ); |
713 | connect( mMoveAction, SIGNAL( activated() ), | 713 | connect( mMoveAction, SIGNAL( activated() ), |
714 | mView, SLOT( moveIncidence() ) ); | 714 | mView, SLOT( moveIncidence() ) ); |
715 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 715 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
716 | mBeamAction->addTo( actionMenu ); | 716 | mBeamAction->addTo( actionMenu ); |
717 | connect( mBeamAction, SIGNAL( activated() ), | 717 | connect( mBeamAction, SIGNAL( activated() ), |
718 | mView, SLOT( beamIncidence() ) ); | 718 | mView, SLOT( beamIncidence() ) ); |
719 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 719 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
720 | mCancelAction->addTo( actionMenu ); | 720 | mCancelAction->addTo( actionMenu ); |
721 | connect( mCancelAction, SIGNAL( activated() ), | 721 | connect( mCancelAction, SIGNAL( activated() ), |
722 | mView, SLOT( toggleCancelIncidence() ) ); | 722 | mView, SLOT( toggleCancelIncidence() ) ); |
723 | 723 | ||
724 | actionMenu->insertSeparator(); | 724 | actionMenu->insertSeparator(); |
725 | 725 | ||
726 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 726 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
727 | this ); | 727 | this ); |
728 | action->addTo( actionMenu ); | 728 | action->addTo( actionMenu ); |
729 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 729 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
730 | 730 | ||
731 | icon = loadPixmap( pathString + "search" ); | 731 | icon = loadPixmap( pathString + "search" ); |
732 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 732 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
733 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 733 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
734 | search_action->addTo( actionMenu ); | 734 | search_action->addTo( actionMenu ); |
735 | connect( search_action, SIGNAL( activated() ), | 735 | connect( search_action, SIGNAL( activated() ), |
736 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 736 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
737 | 737 | ||
738 | icon = loadPixmap( pathString + "today" ); | 738 | icon = loadPixmap( pathString + "today" ); |
739 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 739 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
740 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 740 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
741 | today_action->addTo( actionMenu ); | 741 | today_action->addTo( actionMenu ); |
742 | connect( today_action, SIGNAL( activated() ), | 742 | connect( today_action, SIGNAL( activated() ), |
743 | mView, SLOT( goToday() ) ); | 743 | mView, SLOT( goToday() ) ); |
744 | 744 | ||
745 | if ( KOPrefs::instance()->mShowFullMenu ) { | 745 | if ( KOPrefs::instance()->mShowFullMenu ) { |
746 | actionMenu->insertSeparator(); | 746 | actionMenu->insertSeparator(); |
747 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 747 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
748 | 748 | ||
749 | } | 749 | } |
750 | // actionMenu->insertSeparator(); | 750 | // actionMenu->insertSeparator(); |
751 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 751 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
752 | this ); | 752 | this ); |
753 | action->addTo( importMenu ); | 753 | action->addTo( importMenu ); |
754 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 754 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
755 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 755 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
756 | this ); | 756 | this ); |
757 | action->addTo( importMenu ); | 757 | action->addTo( importMenu ); |
758 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 758 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
759 | importMenu->insertSeparator(); | 759 | importMenu->insertSeparator(); |
760 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 760 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
761 | this ); | 761 | this ); |
762 | action->addTo( importMenu ); | 762 | action->addTo( importMenu ); |
763 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 763 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
764 | #ifndef DESKTOP_VERSION | 764 | #ifndef DESKTOP_VERSION |
765 | importMenu->insertSeparator(); | 765 | importMenu->insertSeparator(); |
766 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 766 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
767 | this ); | 767 | this ); |
768 | action->addTo( importMenu ); | 768 | action->addTo( importMenu ); |
769 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 769 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
770 | #else | 770 | #else |
771 | #ifdef _WIN32_ | 771 | #ifdef _WIN32_ |
772 | importMenu->insertSeparator(); | 772 | importMenu->insertSeparator(); |
773 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 773 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
774 | this ); | 774 | this ); |
775 | action->addTo( importMenu ); | 775 | action->addTo( importMenu ); |
776 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 776 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
777 | #endif | 777 | #endif |
778 | #endif | 778 | #endif |
779 | 779 | ||
780 | importMenu->insertSeparator(); | 780 | importMenu->insertSeparator(); |
781 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 781 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
782 | this ); | 782 | this ); |
783 | action->addTo( importMenu ); | 783 | action->addTo( importMenu ); |
784 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 784 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
785 | 785 | ||
786 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 786 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
787 | this ); | 787 | this ); |
788 | action->addTo( importMenu ); | 788 | action->addTo( importMenu ); |
789 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 789 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
790 | 790 | ||
791 | importMenu->insertSeparator(); | 791 | importMenu->insertSeparator(); |
792 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 792 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
793 | this ); | 793 | this ); |
794 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 794 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
795 | 795 | ||
796 | 796 | ||
797 | //LR | 797 | //LR |
798 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 798 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
799 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 799 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
800 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 800 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
801 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 801 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
802 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); | 802 | importMenu->insertItem( i18n("Export to phone"), ex2phone ); |
803 | 803 | ||
804 | importMenu->insertSeparator(); | 804 | importMenu->insertSeparator(); |
805 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 805 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
806 | this ); | 806 | this ); |
807 | action->addTo( importMenu ); | 807 | action->addTo( importMenu ); |
808 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 808 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
809 | #ifndef DESKTOP_VERSION | 809 | #ifndef DESKTOP_VERSION |
810 | importMenu->insertSeparator(); | 810 | importMenu->insertSeparator(); |
811 | brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0, | 811 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
812 | this ); | 812 | this ); |
813 | brAction->addTo( importMenu ); | 813 | brAction->addTo( importMenu ); |
814 | brAction->setToggleAction (true ) ; | 814 | brAction->setToggleAction (true ) ; |
815 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 815 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
816 | 816 | ||
817 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 817 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
818 | this ); | 818 | this ); |
819 | action->addTo( importMenu ); | 819 | action->addTo( importMenu ); |
820 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 820 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
821 | 821 | ||
822 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 822 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
823 | this ); | 823 | this ); |
824 | action->addTo( importMenu ); | 824 | action->addTo( importMenu ); |
825 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 825 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
826 | #else | 826 | #else |
827 | importMenu->insertSeparator(); | 827 | importMenu->insertSeparator(); |
828 | icon = loadPixmap( pathString + "print" ); | 828 | icon = loadPixmap( pathString + "print" ); |
829 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 829 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
830 | action->addTo( importMenu ); | 830 | action->addTo( importMenu ); |
831 | connect( action, SIGNAL( activated() ), | 831 | connect( action, SIGNAL( activated() ), |
832 | this, SLOT( printCal() ) ); | 832 | this, SLOT( printCal() ) ); |
833 | 833 | ||
834 | icon = loadPixmap( pathString + "print" ); | 834 | icon = loadPixmap( pathString + "print" ); |
835 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 835 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
836 | action->addTo( importMenu ); | 836 | action->addTo( importMenu ); |
837 | connect( action, SIGNAL( activated() ), | 837 | connect( action, SIGNAL( activated() ), |
838 | this, SLOT( printSel() ) ); | 838 | this, SLOT( printSel() ) ); |
839 | #endif | 839 | #endif |
840 | importMenu->insertSeparator(); | 840 | importMenu->insertSeparator(); |
841 | action = new QAction( "beam all", i18n("Save"), 0, | 841 | action = new QAction( "beam all", i18n("Save"), 0, |
842 | this ); | 842 | this ); |
843 | action->addTo( importMenu ); | 843 | action->addTo( importMenu ); |
844 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 844 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
845 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 845 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
846 | this ); | 846 | this ); |
847 | action->addTo( importMenu ); | 847 | action->addTo( importMenu ); |
848 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 848 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
849 | 849 | ||
850 | //menuBar->insertItem( "Configure",configureMenu ); | 850 | //menuBar->insertItem( "Configure",configureMenu ); |
851 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 851 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
852 | icon = loadPixmap( "korganizer/korganizer" ); | 852 | icon = loadPixmap( "korganizer/korganizer" ); |
853 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 853 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
854 | action->addTo( helpMenu ); | 854 | action->addTo( helpMenu ); |
855 | connect( action, SIGNAL( activated() ), | 855 | connect( action, SIGNAL( activated() ), |
856 | SLOT( keyBindings() ) ); | 856 | SLOT( keyBindings() ) ); |
857 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 857 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
858 | action->addTo( helpMenu ); | 858 | action->addTo( helpMenu ); |
859 | connect( action, SIGNAL( activated() ), | 859 | connect( action, SIGNAL( activated() ), |
860 | SLOT( features() ) ); | 860 | SLOT( features() ) ); |
861 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 861 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
862 | action->addTo( helpMenu ); | 862 | action->addTo( helpMenu ); |
863 | connect( action, SIGNAL( activated() ), | 863 | connect( action, SIGNAL( activated() ), |
864 | SLOT( aboutAutoSaving() ) ); | 864 | SLOT( aboutAutoSaving() ) ); |
865 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 865 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
866 | action->addTo( helpMenu ); | 866 | action->addTo( helpMenu ); |
867 | connect( action, SIGNAL( activated() ), | 867 | connect( action, SIGNAL( activated() ), |
868 | SLOT( aboutKnownBugs() ) ); | 868 | SLOT( aboutKnownBugs() ) ); |
869 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 869 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
870 | action->addTo( helpMenu ); | 870 | action->addTo( helpMenu ); |
871 | connect( action, SIGNAL( activated() ), | 871 | connect( action, SIGNAL( activated() ), |
872 | SLOT( usertrans() ) ); | 872 | SLOT( usertrans() ) ); |
873 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 873 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
874 | action->addTo( helpMenu ); | 874 | action->addTo( helpMenu ); |
875 | connect( action, SIGNAL( activated() ), | 875 | connect( action, SIGNAL( activated() ), |
876 | SLOT( synchowto() ) ); | 876 | SLOT( synchowto() ) ); |
877 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 877 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
878 | action->addTo( helpMenu ); | 878 | action->addTo( helpMenu ); |
879 | connect( action, SIGNAL( activated() ), | 879 | connect( action, SIGNAL( activated() ), |
880 | SLOT( whatsNew() ) ); | 880 | SLOT( whatsNew() ) ); |
881 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 881 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
882 | action->addTo( helpMenu ); | 882 | action->addTo( helpMenu ); |
883 | connect( action, SIGNAL( activated() ), | 883 | connect( action, SIGNAL( activated() ), |
884 | SLOT( faq() ) ); | 884 | SLOT( faq() ) ); |
885 | 885 | ||
886 | 886 | ||
887 | action = new QAction( "about", i18n("About..."), 0, this ); | 887 | action = new QAction( "about", i18n("About..."), 0, this ); |
888 | action->addTo( helpMenu ); | 888 | action->addTo( helpMenu ); |
889 | connect( action, SIGNAL( activated() ), | 889 | connect( action, SIGNAL( activated() ), |
890 | SLOT( about() ) ); | 890 | SLOT( about() ) ); |
891 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 891 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
892 | action->addTo( helpMenu ); | 892 | action->addTo( helpMenu ); |
893 | connect( action, SIGNAL( activated() ), | 893 | connect( action, SIGNAL( activated() ), |
894 | SLOT( licence() ) ); | 894 | SLOT( licence() ) ); |
895 | //menuBar->insertSeparator(); | 895 | //menuBar->insertSeparator(); |
896 | 896 | ||
897 | // ****************************************************** | 897 | // ****************************************************** |
898 | // menubar icons | 898 | // menubar icons |
899 | 899 | ||
900 | 900 | ||
901 | iconToolBar->setHorizontalStretchable (true ); | 901 | iconToolBar->setHorizontalStretchable (true ); |
902 | //menuBar->insertItem( iconToolBar ); | 902 | //menuBar->insertItem( iconToolBar ); |
903 | //xdays_action | 903 | //xdays_action |
904 | if (p-> mShowIconNewEvent) | 904 | if (p-> mShowIconNewEvent) |
905 | ne_action->addTo( iconToolBar ); | 905 | ne_action->addTo( iconToolBar ); |
906 | if (p->mShowIconNewTodo ) | 906 | if (p->mShowIconNewTodo ) |
907 | nt_action->addTo( iconToolBar ); | 907 | nt_action->addTo( iconToolBar ); |
908 | if (p-> mShowIconSearch) | 908 | if (p-> mShowIconSearch) |
909 | search_action->addTo( iconToolBar ); | 909 | search_action->addTo( iconToolBar ); |
910 | if (p-> mShowIconNext) | 910 | if (p-> mShowIconNext) |
911 | whatsnext_action->addTo( iconToolBar ); | 911 | whatsnext_action->addTo( iconToolBar ); |
912 | if (p-> mShowIconNextDays) | 912 | if (p-> mShowIconNextDays) |
913 | xdays_action->addTo( iconToolBar ); | 913 | xdays_action->addTo( iconToolBar ); |
914 | if (p-> mShowIconList) | 914 | if (p-> mShowIconList) |
915 | showlist_action->addTo( iconToolBar ); | 915 | showlist_action->addTo( iconToolBar ); |
916 | if (p-> mShowIconDay1) | 916 | if (p-> mShowIconDay1) |
917 | day1_action->addTo( iconToolBar ); | 917 | day1_action->addTo( iconToolBar ); |
918 | if (p-> mShowIconDay5) | 918 | if (p-> mShowIconDay5) |
919 | day5_action->addTo( iconToolBar ); | 919 | day5_action->addTo( iconToolBar ); |
920 | if (p-> mShowIconDay7) | 920 | if (p-> mShowIconDay7) |
921 | day7_action->addTo( iconToolBar ); | 921 | day7_action->addTo( iconToolBar ); |
922 | if (p-> mShowIconMonth) | 922 | if (p-> mShowIconMonth) |
923 | month_action->addTo( iconToolBar ); | 923 | month_action->addTo( iconToolBar ); |
924 | if (p-> mShowIconTodoview) | 924 | if (p-> mShowIconTodoview) |
925 | todoview_action->addTo( iconToolBar ); | 925 | todoview_action->addTo( iconToolBar ); |
926 | if (p-> mShowIconJournal) | 926 | if (p-> mShowIconJournal) |
927 | viewjournal_action->addTo( iconToolBar ); | 927 | viewjournal_action->addTo( iconToolBar ); |
928 | icon = loadPixmap( pathString + "2leftarrowB" ); | 928 | icon = loadPixmap( pathString + "2leftarrowB" ); |
929 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 929 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
930 | if (p-> mShowIconBackFast) { | 930 | if (p-> mShowIconBackFast) { |
931 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 931 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
932 | connect( action, SIGNAL( activated() ), | 932 | connect( action, SIGNAL( activated() ), |
933 | mView, SLOT( goPreviousMonth() ) ); | 933 | mView, SLOT( goPreviousMonth() ) ); |
934 | action->addTo( iconToolBar ); | 934 | action->addTo( iconToolBar ); |
935 | } | 935 | } |
936 | icon = loadPixmap( pathString + "1leftarrowB" ); | 936 | icon = loadPixmap( pathString + "1leftarrowB" ); |
937 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 937 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
938 | if (p-> mShowIconBack) { | 938 | if (p-> mShowIconBack) { |
939 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 939 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
940 | connect( action, SIGNAL( activated() ), | 940 | connect( action, SIGNAL( activated() ), |
941 | mView, SLOT( goPrevious() ) ); | 941 | mView, SLOT( goPrevious() ) ); |
942 | action->addTo( iconToolBar ); | 942 | action->addTo( iconToolBar ); |
943 | } | 943 | } |
944 | if (p-> mShowIconToday) | 944 | if (p-> mShowIconToday) |
945 | today_action->addTo( iconToolBar ); | 945 | today_action->addTo( iconToolBar ); |
946 | icon = loadPixmap( pathString + "1rightarrowB" ); | 946 | icon = loadPixmap( pathString + "1rightarrowB" ); |
947 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 947 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
948 | if (p-> mShowIconForward) { | 948 | if (p-> mShowIconForward) { |
949 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 949 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
950 | connect( action, SIGNAL( activated() ), | 950 | connect( action, SIGNAL( activated() ), |
951 | mView, SLOT( goNext() ) ); | 951 | mView, SLOT( goNext() ) ); |
952 | action->addTo( iconToolBar ); | 952 | action->addTo( iconToolBar ); |
953 | } | 953 | } |
954 | icon = loadPixmap( pathString + "2rightarrowB" ); | 954 | icon = loadPixmap( pathString + "2rightarrowB" ); |
955 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 955 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
956 | if (p-> mShowIconForwardFast) { | 956 | if (p-> mShowIconForwardFast) { |
957 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 957 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
958 | connect( action, SIGNAL( activated() ), | 958 | connect( action, SIGNAL( activated() ), |
959 | mView, SLOT( goNextMonth() ) ); | 959 | mView, SLOT( goNextMonth() ) ); |
960 | action->addTo( iconToolBar ); | 960 | action->addTo( iconToolBar ); |
961 | } | 961 | } |
962 | 962 | ||
963 | 963 | ||
964 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 964 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
965 | 965 | ||
966 | if (p-> mShowIconNewEvent) | 966 | if (p-> mShowIconNewEvent) |
967 | configureToolBarMenu->setItemChecked( 10, true ); | 967 | configureToolBarMenu->setItemChecked( 10, true ); |
968 | if (p->mShowIconNewTodo ) | 968 | if (p->mShowIconNewTodo ) |
969 | configureToolBarMenu->setItemChecked( 20, true ); | 969 | configureToolBarMenu->setItemChecked( 20, true ); |
970 | if (p-> mShowIconSearch) | 970 | if (p-> mShowIconSearch) |
971 | configureToolBarMenu->setItemChecked( 120, true ); | 971 | configureToolBarMenu->setItemChecked( 120, true ); |
972 | if (p-> mShowIconList) | 972 | if (p-> mShowIconList) |
973 | configureToolBarMenu->setItemChecked( 30, true ); | 973 | configureToolBarMenu->setItemChecked( 30, true ); |
974 | if (p-> mShowIconDay1) | 974 | if (p-> mShowIconDay1) |
975 | configureToolBarMenu->setItemChecked( 40, true ); | 975 | configureToolBarMenu->setItemChecked( 40, true ); |
976 | if (p-> mShowIconDay5) | 976 | if (p-> mShowIconDay5) |
977 | configureToolBarMenu->setItemChecked( 50, true ); | 977 | configureToolBarMenu->setItemChecked( 50, true ); |
978 | if (p-> mShowIconDay7) | 978 | if (p-> mShowIconDay7) |
979 | configureToolBarMenu->setItemChecked( 60, true ); | 979 | configureToolBarMenu->setItemChecked( 60, true ); |
980 | if (p-> mShowIconMonth) | 980 | if (p-> mShowIconMonth) |
981 | configureToolBarMenu->setItemChecked( 70, true ); | 981 | configureToolBarMenu->setItemChecked( 70, true ); |
982 | if (p-> mShowIconTodoview) | 982 | if (p-> mShowIconTodoview) |
983 | configureToolBarMenu->setItemChecked( 80, true ); | 983 | configureToolBarMenu->setItemChecked( 80, true ); |
984 | if (p-> mShowIconBackFast) | 984 | if (p-> mShowIconBackFast) |
985 | configureToolBarMenu->setItemChecked( 200, true ); | 985 | configureToolBarMenu->setItemChecked( 200, true ); |
986 | if (p-> mShowIconBack) | 986 | if (p-> mShowIconBack) |
987 | configureToolBarMenu->setItemChecked( 210, true ); | 987 | configureToolBarMenu->setItemChecked( 210, true ); |
988 | if (p-> mShowIconToday) | 988 | if (p-> mShowIconToday) |
989 | configureToolBarMenu->setItemChecked( 130, true ); | 989 | configureToolBarMenu->setItemChecked( 130, true ); |
990 | if (p-> mShowIconForward) | 990 | if (p-> mShowIconForward) |
991 | configureToolBarMenu->setItemChecked( 220, true ); | 991 | configureToolBarMenu->setItemChecked( 220, true ); |
992 | if (p-> mShowIconForwardFast) | 992 | if (p-> mShowIconForwardFast) |
993 | configureToolBarMenu->setItemChecked( 230, true ); | 993 | configureToolBarMenu->setItemChecked( 230, true ); |
994 | if (p-> mShowIconNextDays) | 994 | if (p-> mShowIconNextDays) |
995 | configureToolBarMenu->setItemChecked( 100, true ); | 995 | configureToolBarMenu->setItemChecked( 100, true ); |
996 | if (p-> mShowIconNext) | 996 | if (p-> mShowIconNext) |
997 | configureToolBarMenu->setItemChecked( 110, true ); | 997 | configureToolBarMenu->setItemChecked( 110, true ); |
998 | if (p-> mShowIconJournal) | 998 | if (p-> mShowIconJournal) |
999 | configureToolBarMenu->setItemChecked( 90, true ); | 999 | configureToolBarMenu->setItemChecked( 90, true ); |
1000 | if (p-> mShowIconWhatsThis) | 1000 | if (p-> mShowIconWhatsThis) |
1001 | configureToolBarMenu->setItemChecked( 300, true ); | 1001 | configureToolBarMenu->setItemChecked( 300, true ); |
1002 | 1002 | ||
1003 | QLabel* dummy = new QLabel( iconToolBar ); | 1003 | QLabel* dummy = new QLabel( iconToolBar ); |
1004 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1004 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1005 | if (!p-> mShowIconStretch) | 1005 | if (!p-> mShowIconStretch) |
1006 | iconToolBar->setStretchableWidget ( dummy ) ; | 1006 | iconToolBar->setStretchableWidget ( dummy ) ; |
1007 | else | 1007 | else |
1008 | configureToolBarMenu->setItemChecked( 5, true ); | 1008 | configureToolBarMenu->setItemChecked( 5, true ); |
1009 | if (p-> mShowIconWhatsThis) | 1009 | if (p-> mShowIconWhatsThis) |
1010 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1010 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1011 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1011 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1012 | configureAgenda( p->mHourSize ); | 1012 | configureAgenda( p->mHourSize ); |
1013 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1013 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | void MainWindow::exportToPhone( int mode ) | 1016 | void MainWindow::exportToPhone( int mode ) |
1017 | { | 1017 | { |
1018 | 1018 | ||
1019 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1019 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1020 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1020 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1021 | KOex2phonePrefs ex2phone; | 1021 | KOex2phonePrefs ex2phone; |
1022 | 1022 | ||
1023 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1023 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1024 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1024 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1025 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1025 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1026 | if ( mode == 1 ) | 1026 | if ( mode == 1 ) |
1027 | ex2phone.setCaption(i18n("Export complete calendar")); | 1027 | ex2phone.setCaption(i18n("Export complete calendar")); |
1028 | if ( mode == 2 ) | 1028 | if ( mode == 2 ) |
1029 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1029 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1030 | 1030 | ||
1031 | if ( !ex2phone.exec() ) { | 1031 | if ( !ex2phone.exec() ) { |
1032 | return; | 1032 | return; |
1033 | } | 1033 | } |
1034 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1034 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1035 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1035 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1036 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1036 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1037 | 1037 | ||
1038 | int inFuture = 0; | 1038 | int inFuture = 0; |
1039 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1039 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1040 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1040 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1041 | QPtrList<Incidence> delSel; | 1041 | QPtrList<Incidence> delSel; |
1042 | if ( mode == 1 ) | 1042 | if ( mode == 1 ) |
1043 | delSel = mCalendar->rawIncidences(); | 1043 | delSel = mCalendar->rawIncidences(); |
1044 | if ( mode == 2 ) | 1044 | if ( mode == 2 ) |
1045 | delSel = mCalendar->incidences(); | 1045 | delSel = mCalendar->incidences(); |
1046 | CalendarLocal* cal = new CalendarLocal(); | 1046 | CalendarLocal* cal = new CalendarLocal(); |
1047 | cal->setLocalTime(); | 1047 | cal->setLocalTime(); |
1048 | Incidence *incidence = delSel.first(); | 1048 | Incidence *incidence = delSel.first(); |
1049 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1049 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1050 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1050 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1051 | while ( incidence ) { | 1051 | while ( incidence ) { |
1052 | if ( incidence->type() != "Journal" ) { | 1052 | if ( incidence->type() != "Journal" ) { |
1053 | bool add = true; | 1053 | bool add = true; |
1054 | if ( inFuture ) { | 1054 | if ( inFuture ) { |
1055 | QDateTime dt; | 1055 | QDateTime dt; |
1056 | if ( incidence->type() == "Todo" ) { | 1056 | if ( incidence->type() == "Todo" ) { |
1057 | Todo * t = (Todo*)incidence; | 1057 | Todo * t = (Todo*)incidence; |
1058 | if ( t->hasDueDate() ) | 1058 | if ( t->hasDueDate() ) |
1059 | dt = t->dtDue(); | 1059 | dt = t->dtDue(); |
1060 | else | 1060 | else |
1061 | dt = cur.addSecs( 62 ); | 1061 | dt = cur.addSecs( 62 ); |
1062 | } | 1062 | } |
1063 | else { | 1063 | else { |
1064 | bool ok; | 1064 | bool ok; |
1065 | dt = incidence->getNextOccurence( cur, &ok ); | 1065 | dt = incidence->getNextOccurence( cur, &ok ); |
1066 | if ( !ok ) | 1066 | if ( !ok ) |
1067 | dt = cur.addSecs( -62 ); | 1067 | dt = cur.addSecs( -62 ); |
1068 | } | 1068 | } |
1069 | if ( dt < cur || dt > end ) { | 1069 | if ( dt < cur || dt > end ) { |
1070 | add = false; | 1070 | add = false; |
1071 | } | 1071 | } |
1072 | } | 1072 | } |
1073 | if ( add ) { | 1073 | if ( add ) { |
1074 | Incidence *in = incidence->clone(); | 1074 | Incidence *in = incidence->clone(); |
1075 | cal->addIncidence( in ); | 1075 | cal->addIncidence( in ); |
1076 | } | 1076 | } |
1077 | } | 1077 | } |
1078 | incidence = delSel.next(); | 1078 | incidence = delSel.next(); |
1079 | } | 1079 | } |
1080 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1080 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1081 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1081 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1082 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1082 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1083 | 1083 | ||
1084 | setCaption( i18n("Writing to phone...")); | 1084 | setCaption( i18n("Writing to phone...")); |
1085 | if ( PhoneFormat::writeToPhone( cal ) ) | 1085 | if ( PhoneFormat::writeToPhone( cal ) ) |
1086 | setCaption( i18n("Export to phone successful!")); | 1086 | setCaption( i18n("Export to phone successful!")); |
1087 | else | 1087 | else |
1088 | setCaption( i18n("Error exporting to phone!")); | 1088 | setCaption( i18n("Error exporting to phone!")); |
1089 | delete cal; | 1089 | delete cal; |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | 1092 | ||
1093 | void MainWindow::setDefaultPreferences() | 1093 | void MainWindow::setDefaultPreferences() |
1094 | { | 1094 | { |
1095 | KOPrefs *p = KOPrefs::instance(); | 1095 | KOPrefs *p = KOPrefs::instance(); |
1096 | 1096 | ||
1097 | p->mCompactDialogs = true; | 1097 | p->mCompactDialogs = true; |
1098 | p->mConfirm = true; | 1098 | p->mConfirm = true; |
1099 | // p->mEnableQuickTodo = false; | 1099 | // p->mEnableQuickTodo = false; |
1100 | 1100 | ||
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | QString MainWindow::resourcePath() | 1103 | QString MainWindow::resourcePath() |
1104 | { | 1104 | { |
1105 | return KGlobal::iconLoader()->iconPath(); | 1105 | return KGlobal::iconLoader()->iconPath(); |
1106 | } | 1106 | } |
1107 | 1107 | ||
1108 | void MainWindow::displayText( QString text ,QString cap ) | 1108 | void MainWindow::displayText( QString text ,QString cap ) |
1109 | { | 1109 | { |
1110 | QDialog dia( this, "name", true ); ; | 1110 | QDialog dia( this, "name", true ); ; |
1111 | dia.setCaption( cap ); | 1111 | dia.setCaption( cap ); |
1112 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1112 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1113 | lay->setSpacing( 3 ); | 1113 | lay->setSpacing( 3 ); |
1114 | lay->setMargin( 3 ); | 1114 | lay->setMargin( 3 ); |
1115 | QTextBrowser tb ( &dia ); | 1115 | QTextBrowser tb ( &dia ); |
1116 | lay->addWidget( &tb ); | 1116 | lay->addWidget( &tb ); |
1117 | tb.setText( text ); | 1117 | tb.setText( text ); |
1118 | #ifdef DESKTOP_VERSION | 1118 | #ifdef DESKTOP_VERSION |
1119 | dia.resize( 640, 480); | 1119 | dia.resize( 640, 480); |
1120 | #else | 1120 | #else |
1121 | dia.showMaximized(); | 1121 | dia.showMaximized(); |
1122 | #endif | 1122 | #endif |
1123 | dia.exec(); | 1123 | dia.exec(); |
1124 | } | 1124 | } |
1125 | void MainWindow::displayFile( QString fn, QString cap ) | 1125 | void MainWindow::displayFile( QString fn, QString cap ) |
1126 | { | 1126 | { |
1127 | QString fileName = resourcePath() + fn; | 1127 | QString fileName = resourcePath() + fn; |
1128 | QString text; | 1128 | QString text; |
1129 | QFile file( fileName ); | 1129 | QFile file( fileName ); |
1130 | if (!file.open( IO_ReadOnly ) ) { | 1130 | if (!file.open( IO_ReadOnly ) ) { |
1131 | return ; | 1131 | return ; |
1132 | 1132 | ||
1133 | } | 1133 | } |
1134 | QTextStream ts( &file ); | 1134 | QTextStream ts( &file ); |
1135 | text = ts.read(); | 1135 | text = ts.read(); |
1136 | file.close(); | 1136 | file.close(); |
1137 | displayText( text, cap); | 1137 | displayText( text, cap); |
1138 | } | 1138 | } |
1139 | void MainWindow::features() | 1139 | void MainWindow::features() |
1140 | { | 1140 | { |
1141 | 1141 | ||
1142 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1142 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | void MainWindow::usertrans() | 1145 | void MainWindow::usertrans() |
1146 | { | 1146 | { |
1147 | 1147 | ||
1148 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1148 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | void MainWindow::synchowto() | 1151 | void MainWindow::synchowto() |
1152 | { | 1152 | { |
1153 | 1153 | ||
1154 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1154 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1155 | } | 1155 | } |
1156 | void MainWindow::faq() | 1156 | void MainWindow::faq() |
1157 | { | 1157 | { |
1158 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1158 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1159 | 1159 | ||
1160 | } | 1160 | } |
1161 | void MainWindow::whatsNew() | 1161 | void MainWindow::whatsNew() |
1162 | { | 1162 | { |
1163 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1163 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1164 | 1164 | ||
1165 | } | 1165 | } |
1166 | void MainWindow::licence() | 1166 | void MainWindow::licence() |
1167 | { | 1167 | { |
1168 | KApplication::showLicence(); | 1168 | KApplication::showLicence(); |
1169 | 1169 | ||
1170 | } | 1170 | } |
1171 | void MainWindow::about() | 1171 | void MainWindow::about() |
1172 | { | 1172 | { |
1173 | QString version; | 1173 | QString version; |
1174 | #include <../version> | 1174 | #include <../version> |
1175 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1175 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1176 | i18n("KOrganizer/Platform-independent\n") + | 1176 | i18n("KOrganizer/Platform-independent\n") + |
1177 | "(KO/Pi) " + version + " - " + | 1177 | "(KO/Pi) " + version + " - " + |
1178 | 1178 | ||
1179 | #ifdef DESKTOP_VERSION | 1179 | #ifdef DESKTOP_VERSION |
1180 | i18n("Desktop Edition\n") + | 1180 | i18n("Desktop Edition\n") + |
1181 | #else | 1181 | #else |
1182 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1182 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1183 | #endif | 1183 | #endif |
1184 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); | 1184 | i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); |
1185 | } | 1185 | } |
1186 | void MainWindow::keyBindings() | 1186 | void MainWindow::keyBindings() |
1187 | { | 1187 | { |
1188 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1188 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1189 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1189 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1190 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1190 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1191 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1191 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1192 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1192 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1193 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1193 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1194 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1194 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1195 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1195 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1196 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1196 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1197 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1197 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1198 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1198 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1199 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1199 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1200 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1200 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1201 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1201 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1202 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1202 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1203 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1203 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1204 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1204 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1205 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1205 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1206 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1206 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1207 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1207 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1208 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1208 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1209 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1209 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1210 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1210 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1211 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1211 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1212 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1212 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1213 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1213 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1214 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1214 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1215 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1215 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1216 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1216 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1217 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1217 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1218 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1218 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1219 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1219 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1220 | i18n("<p><h3>In list view:</h3></p>\n") + | 1220 | i18n("<p><h3>In list view:</h3></p>\n") + |
1221 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1221 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1222 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1222 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1223 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1223 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1224 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1224 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1225 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1225 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1226 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1226 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1227 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1227 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1228 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1228 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1229 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1229 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1230 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1230 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1231 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1231 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1232 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1232 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1233 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1233 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1234 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1234 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1235 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1235 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1236 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1236 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1237 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1237 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1238 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1238 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1239 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1239 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1240 | displayText( text, cap); | 1240 | displayText( text, cap); |
1241 | 1241 | ||
1242 | } | 1242 | } |
1243 | void MainWindow::aboutAutoSaving() | 1243 | void MainWindow::aboutAutoSaving() |
1244 | { | 1244 | { |
1245 | QMessageBox* msg; | 1245 | QMessageBox* msg; |
1246 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1246 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1247 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, | 1247 | i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, |
1248 | QMessageBox::Ok, | 1248 | QMessageBox::Ok, |
1249 | QMessageBox::NoButton, | 1249 | QMessageBox::NoButton, |
1250 | QMessageBox::NoButton); | 1250 | QMessageBox::NoButton); |
1251 | msg->exec(); | 1251 | msg->exec(); |
1252 | delete msg; | 1252 | delete msg; |
1253 | 1253 | ||
1254 | 1254 | ||
1255 | } | 1255 | } |
1256 | void MainWindow::aboutKnownBugs() | 1256 | void MainWindow::aboutKnownBugs() |
1257 | { | 1257 | { |
1258 | QMessageBox* msg; | 1258 | QMessageBox* msg; |
1259 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1259 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1260 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1260 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1261 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1261 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1262 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1262 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1263 | i18n("\nor report them in the bugtracker on\n") + | 1263 | i18n("\nor report them in the bugtracker on\n") + |
1264 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1264 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1265 | QMessageBox::NoIcon, | 1265 | QMessageBox::NoIcon, |
1266 | QMessageBox::Ok, | 1266 | QMessageBox::Ok, |
1267 | QMessageBox::NoButton, | 1267 | QMessageBox::NoButton, |
1268 | QMessageBox::NoButton); | 1268 | QMessageBox::NoButton); |
1269 | msg->exec(); | 1269 | msg->exec(); |
1270 | delete msg; | 1270 | delete msg; |
1271 | 1271 | ||
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | QString MainWindow::defaultFileName() | 1274 | QString MainWindow::defaultFileName() |
1275 | { | 1275 | { |
1276 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1276 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1277 | } | 1277 | } |
1278 | QString MainWindow::syncFileName() | 1278 | QString MainWindow::syncFileName() |
1279 | { | 1279 | { |
1280 | #ifdef DESKTOP_VERSION | 1280 | #ifdef DESKTOP_VERSION |
1281 | return locateLocal( "tmp", "synccalendar.ics" ); | 1281 | return locateLocal( "tmp", "synccalendar.ics" ); |
1282 | #else | 1282 | #else |
1283 | return QString( "/tmp/synccalendar.ics" ); | 1283 | return QString( "/tmp/synccalendar.ics" ); |
1284 | #endif | 1284 | #endif |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1287 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1288 | { | 1288 | { |
1289 | if ( !incidence ) { | 1289 | if ( !incidence ) { |
1290 | enableIncidenceActions( false ); | 1290 | enableIncidenceActions( false ); |
1291 | 1291 | ||
1292 | mNewSubTodoAction->setEnabled( false ); | 1292 | mNewSubTodoAction->setEnabled( false ); |
1293 | setCaptionToDates(); | 1293 | setCaptionToDates(); |
1294 | return; | 1294 | return; |
1295 | 1295 | ||
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | //KGlobal::locale()->formatDateTime(nextA, true); | 1298 | //KGlobal::locale()->formatDateTime(nextA, true); |
1299 | QString startString = ""; | 1299 | QString startString = ""; |
1300 | if ( incidence->type() != "Todo" ) { | 1300 | if ( incidence->type() != "Todo" ) { |
1301 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1301 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1302 | if ( incidence->doesFloat() ) { | 1302 | if ( incidence->doesFloat() ) { |
1303 | startString += ": "+incidence->dtStartDateStr( true ); | 1303 | startString += ": "+incidence->dtStartDateStr( true ); |
1304 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1304 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1305 | 1305 | ||
1306 | } else { | 1306 | } else { |
1307 | startString = ": "+incidence->dtStartStr(true); | 1307 | startString = ": "+incidence->dtStartStr(true); |
1308 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1308 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1309 | 1309 | ||
1310 | } | 1310 | } |
1311 | 1311 | ||
1312 | } else { | 1312 | } else { |
1313 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1313 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1314 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1314 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1315 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1315 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1316 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1316 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | } | 1319 | } |
1320 | else | 1320 | else |
1321 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1321 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1322 | if ( !incidence->location().isEmpty() ) | 1322 | if ( !incidence->location().isEmpty() ) |
1323 | startString += " (" +incidence->location()+")"; | 1323 | startString += " (" +incidence->location()+")"; |
1324 | setCaption( incidence->summary()+startString); | 1324 | setCaption( incidence->summary()+startString); |
1325 | 1325 | ||
1326 | enableIncidenceActions( true ); | 1326 | enableIncidenceActions( true ); |
1327 | 1327 | ||
1328 | if ( incidence->type() == "Event" ) { | 1328 | if ( incidence->type() == "Event" ) { |
1329 | mShowAction->setText( i18n("Show Event...") ); | 1329 | mShowAction->setText( i18n("Show Event...") ); |
1330 | mEditAction->setText( i18n("Edit Event...") ); | 1330 | mEditAction->setText( i18n("Edit Event...") ); |
1331 | mDeleteAction->setText( i18n("Delete Event...") ); | 1331 | mDeleteAction->setText( i18n("Delete Event...") ); |
1332 | 1332 | ||
1333 | mNewSubTodoAction->setEnabled( false ); | 1333 | mNewSubTodoAction->setEnabled( false ); |
1334 | } else if ( incidence->type() == "Todo" ) { | 1334 | } else if ( incidence->type() == "Todo" ) { |
1335 | mShowAction->setText( i18n("Show Todo...") ); | 1335 | mShowAction->setText( i18n("Show Todo...") ); |
1336 | mEditAction->setText( i18n("Edit Todo...") ); | 1336 | mEditAction->setText( i18n("Edit Todo...") ); |
1337 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1337 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1338 | 1338 | ||
1339 | mNewSubTodoAction->setEnabled( true ); | 1339 | mNewSubTodoAction->setEnabled( true ); |
1340 | } else { | 1340 | } else { |
1341 | mShowAction->setText( i18n("Show...") ); | 1341 | mShowAction->setText( i18n("Show...") ); |
1342 | mShowAction->setText( i18n("Edit...") ); | 1342 | mShowAction->setText( i18n("Edit...") ); |
1343 | mShowAction->setText( i18n("Delete...") ); | 1343 | mShowAction->setText( i18n("Delete...") ); |
1344 | 1344 | ||
1345 | mNewSubTodoAction->setEnabled( false ); | 1345 | mNewSubTodoAction->setEnabled( false ); |
1346 | } | 1346 | } |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | void MainWindow::enableIncidenceActions( bool enabled ) | 1349 | void MainWindow::enableIncidenceActions( bool enabled ) |
1350 | { | 1350 | { |
1351 | mShowAction->setEnabled( enabled ); | 1351 | mShowAction->setEnabled( enabled ); |
1352 | mEditAction->setEnabled( enabled ); | 1352 | mEditAction->setEnabled( enabled ); |
1353 | mDeleteAction->setEnabled( enabled ); | 1353 | mDeleteAction->setEnabled( enabled ); |
1354 | 1354 | ||
1355 | mCloneAction->setEnabled( enabled ); | 1355 | mCloneAction->setEnabled( enabled ); |
1356 | mMoveAction->setEnabled( enabled ); | 1356 | mMoveAction->setEnabled( enabled ); |
1357 | mBeamAction->setEnabled( enabled ); | 1357 | mBeamAction->setEnabled( enabled ); |
1358 | mCancelAction->setEnabled( enabled ); | 1358 | mCancelAction->setEnabled( enabled ); |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | void MainWindow::importOL() | 1361 | void MainWindow::importOL() |
1362 | { | 1362 | { |
1363 | #ifdef _WIN32_ | 1363 | #ifdef _WIN32_ |
1364 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1364 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1365 | id->exec(); | 1365 | id->exec(); |
1366 | delete id; | 1366 | delete id; |
1367 | mView->updateView(); | 1367 | mView->updateView(); |
1368 | #endif | 1368 | #endif |
1369 | } | 1369 | } |
1370 | void MainWindow::importBday() | 1370 | void MainWindow::importBday() |
1371 | { | 1371 | { |
1372 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1372 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1373 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1373 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1374 | i18n("Import!"), i18n("Cancel"), 0, | 1374 | i18n("Import!"), i18n("Cancel"), 0, |
1375 | 0, 1 ); | 1375 | 0, 1 ); |
1376 | if ( result == 0 ) { | 1376 | if ( result == 0 ) { |
1377 | mView->importBday(); | 1377 | mView->importBday(); |
1378 | 1378 | ||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | 1381 | ||
1382 | } | 1382 | } |
1383 | void MainWindow::importQtopia() | 1383 | void MainWindow::importQtopia() |
1384 | { | 1384 | { |
1385 | #ifndef DESKTOP_VERSION | 1385 | #ifndef DESKTOP_VERSION |
1386 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1386 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1387 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1387 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1388 | i18n("Import!"), i18n("Cancel"), 0, | 1388 | i18n("Import!"), i18n("Cancel"), 0, |
1389 | 0, 1 ); | 1389 | 0, 1 ); |
1390 | if ( result == 0 ) { | 1390 | if ( result == 0 ) { |
1391 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1391 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1392 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1392 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1393 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1393 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1394 | mView->importQtopia( categories, datebook, todolist ); | 1394 | mView->importQtopia( categories, datebook, todolist ); |
1395 | } | 1395 | } |
1396 | #else | 1396 | #else |
1397 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1397 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1398 | i18n("Not supported \non desktop!\n"), | 1398 | i18n("Not supported \non desktop!\n"), |
1399 | i18n("Ok"), i18n("Cancel"), 0, | 1399 | i18n("Ok"), i18n("Cancel"), 0, |
1400 | 0, 1 ); | 1400 | 0, 1 ); |
1401 | 1401 | ||
1402 | #endif | 1402 | #endif |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | void MainWindow::saveOnClose() | 1405 | void MainWindow::saveOnClose() |
1406 | { | 1406 | { |
1407 | KOPrefs *p = KOPrefs::instance(); | 1407 | KOPrefs *p = KOPrefs::instance(); |
1408 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1408 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1409 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1409 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1410 | iconToolBar->y() > height()/2; | 1410 | iconToolBar->y() > height()/2; |
1411 | mView->writeSettings(); | 1411 | mView->writeSettings(); |
1412 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1412 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1413 | save(); | 1413 | save(); |
1414 | } | 1414 | } |
1415 | void MainWindow::slotModifiedChanged( bool changed ) | 1415 | void MainWindow::slotModifiedChanged( bool changed ) |
1416 | { | 1416 | { |
1417 | if ( mBlockAtStartup ) | 1417 | if ( mBlockAtStartup ) |
1418 | return; | 1418 | return; |
1419 | int msec; | 1419 | int msec; |
1420 | // we store the changes after 1 minute, | 1420 | // we store the changes after 1 minute, |
1421 | // and for safety reasons after 10 minutes again | 1421 | // and for safety reasons after 10 minutes again |
1422 | if ( !mSyncManager->blockSave() ) | 1422 | if ( !mSyncManager->blockSave() ) |
1423 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1423 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1424 | else | 1424 | else |
1425 | msec = 1000 * 600; | 1425 | msec = 1000 * 600; |
1426 | mSaveTimer.start( msec, true ); // 1 minute | 1426 | mSaveTimer.start( msec, true ); // 1 minute |
1427 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1427 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1428 | mCalendarModifiedFlag = true; | 1428 | mCalendarModifiedFlag = true; |
1429 | } | 1429 | } |
1430 | void MainWindow::save() | 1430 | void MainWindow::save() |
1431 | { | 1431 | { |
1432 | if ( mSyncManager->blockSave() ) | 1432 | if ( mSyncManager->blockSave() ) |
1433 | return; | 1433 | return; |
1434 | mSyncManager->setBlockSave(true); | 1434 | mSyncManager->setBlockSave(true); |
1435 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1435 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1436 | 1436 | ||
1437 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1437 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1438 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1438 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1439 | qDebug("KO: Start saving data to file!"); | 1439 | qDebug("KO: Start saving data to file!"); |
1440 | mView->saveCalendar( defaultFileName() ); | 1440 | mView->saveCalendar( defaultFileName() ); |
1441 | 1441 | ||
1442 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1442 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1443 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1443 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1444 | QString savemes; | 1444 | QString savemes; |
1445 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1445 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1446 | setCaption(savemes); | 1446 | setCaption(savemes); |
1447 | } else | 1447 | } else |
1448 | setCaption(i18n("Saving cancelled!")); | 1448 | setCaption(i18n("Saving cancelled!")); |
1449 | mCalendarModifiedFlag = false; | 1449 | mCalendarModifiedFlag = false; |
1450 | mSyncManager->setBlockSave( false ); | 1450 | mSyncManager->setBlockSave( false ); |
1451 | } | 1451 | } |
1452 | 1452 | ||
1453 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1453 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1454 | { | 1454 | { |
1455 | if ( !e->isAutoRepeat() ) { | 1455 | if ( !e->isAutoRepeat() ) { |
1456 | mFlagKeyPressed = false; | 1456 | mFlagKeyPressed = false; |
1457 | } | 1457 | } |
1458 | } | 1458 | } |
1459 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1459 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1460 | { | 1460 | { |
1461 | qApp->processEvents(); | 1461 | qApp->processEvents(); |
1462 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1462 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1463 | e->ignore(); | 1463 | e->ignore(); |
1464 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1464 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1465 | return; | 1465 | return; |
1466 | } | 1466 | } |
1467 | if (! e->isAutoRepeat() ) | 1467 | if (! e->isAutoRepeat() ) |
1468 | mFlagKeyPressed = true; | 1468 | mFlagKeyPressed = true; |
1469 | KOPrefs *p = KOPrefs::instance(); | 1469 | KOPrefs *p = KOPrefs::instance(); |
1470 | bool showSelectedDates = false; | 1470 | bool showSelectedDates = false; |
1471 | int size; | 1471 | int size; |
1472 | int pro = 0; | 1472 | int pro = 0; |
1473 | //qDebug("MainWindow::keyPressEvent "); | 1473 | //qDebug("MainWindow::keyPressEvent "); |
1474 | switch ( e->key() ) { | 1474 | switch ( e->key() ) { |
1475 | case Qt::Key_Right: | 1475 | case Qt::Key_Right: |
1476 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1476 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1477 | mView->goNextMonth(); | 1477 | mView->goNextMonth(); |
1478 | else | 1478 | else |
1479 | mView->goNext(); | 1479 | mView->goNext(); |
1480 | showSelectedDates = true; | 1480 | showSelectedDates = true; |
1481 | break; | 1481 | break; |
1482 | case Qt::Key_Left: | 1482 | case Qt::Key_Left: |
1483 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1483 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1484 | mView->goPreviousMonth(); | 1484 | mView->goPreviousMonth(); |
1485 | else | 1485 | else |
1486 | mView->goPrevious(); | 1486 | mView->goPrevious(); |
1487 | showSelectedDates = true; | 1487 | showSelectedDates = true; |
1488 | break; | 1488 | break; |
1489 | case Qt::Key_Down: | 1489 | case Qt::Key_Down: |
1490 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1490 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1491 | break; | 1491 | break; |
1492 | case Qt::Key_Up: | 1492 | case Qt::Key_Up: |
1493 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1493 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1494 | break; | 1494 | break; |
1495 | case Qt::Key_I: | 1495 | case Qt::Key_I: |
1496 | mView->showIncidence(); | 1496 | mView->showIncidence(); |
1497 | break; | 1497 | break; |
1498 | case Qt::Key_Delete: | 1498 | case Qt::Key_Delete: |
1499 | case Qt::Key_Backspace: | 1499 | case Qt::Key_Backspace: |
1500 | mView->deleteIncidence(); | 1500 | mView->deleteIncidence(); |
1501 | break; | 1501 | break; |
1502 | case Qt::Key_D: | 1502 | case Qt::Key_D: |
1503 | mView->viewManager()->showDayView(); | 1503 | mView->viewManager()->showDayView(); |
1504 | showSelectedDates = true; | 1504 | showSelectedDates = true; |
1505 | break; | 1505 | break; |
1506 | case Qt::Key_O: | 1506 | case Qt::Key_O: |
1507 | mView->toggleFilerEnabled( ); | 1507 | mView->toggleFilerEnabled( ); |
1508 | break; | 1508 | break; |
1509 | case Qt::Key_0: | 1509 | case Qt::Key_0: |
1510 | case Qt::Key_1: | 1510 | case Qt::Key_1: |
1511 | case Qt::Key_2: | 1511 | case Qt::Key_2: |
1512 | case Qt::Key_3: | 1512 | case Qt::Key_3: |
1513 | case Qt::Key_4: | 1513 | case Qt::Key_4: |
1514 | case Qt::Key_5: | 1514 | case Qt::Key_5: |
1515 | case Qt::Key_6: | 1515 | case Qt::Key_6: |
1516 | case Qt::Key_7: | 1516 | case Qt::Key_7: |
1517 | case Qt::Key_8: | 1517 | case Qt::Key_8: |
1518 | case Qt::Key_9: | 1518 | case Qt::Key_9: |
1519 | pro = e->key()-48; | 1519 | pro = e->key()-48; |
1520 | if ( pro == 0 ) | 1520 | if ( pro == 0 ) |
1521 | pro = 10; | 1521 | pro = 10; |
1522 | if ( e->state() == Qt::ControlButton) | 1522 | if ( e->state() == Qt::ControlButton) |
1523 | pro += 10; | 1523 | pro += 10; |
1524 | break; | 1524 | break; |
1525 | case Qt::Key_M: | 1525 | case Qt::Key_M: |
1526 | mView->viewManager()->showMonthView(); | 1526 | mView->viewManager()->showMonthView(); |
1527 | showSelectedDates = true; | 1527 | showSelectedDates = true; |
1528 | break; | 1528 | break; |
1529 | case Qt::Key_Insert: | 1529 | case Qt::Key_Insert: |
1530 | mView->newEvent(); | 1530 | mView->newEvent(); |
1531 | break; | 1531 | break; |
1532 | case Qt::Key_S : | 1532 | case Qt::Key_S : |
1533 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1533 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1534 | mView->newSubTodo(); | 1534 | mView->newSubTodo(); |
1535 | else | 1535 | else |
1536 | mView->dialogManager()->showSearchDialog(); | 1536 | mView->dialogManager()->showSearchDialog(); |
1537 | break; | 1537 | break; |
1538 | case Qt::Key_Y : | 1538 | case Qt::Key_Y : |
1539 | case Qt::Key_Z : | 1539 | case Qt::Key_Z : |
1540 | mView->viewManager()->showWorkWeekView(); | 1540 | mView->viewManager()->showWorkWeekView(); |
1541 | showSelectedDates = true; | 1541 | showSelectedDates = true; |
1542 | break; | 1542 | break; |
1543 | case Qt::Key_U : | 1543 | case Qt::Key_U : |
1544 | mView->viewManager()->showWeekView(); | 1544 | mView->viewManager()->showWeekView(); |
1545 | showSelectedDates = true; | 1545 | showSelectedDates = true; |
1546 | break; | 1546 | break; |
1547 | case Qt::Key_H : | 1547 | case Qt::Key_H : |
1548 | keyBindings(); | 1548 | keyBindings(); |
1549 | break; | 1549 | break; |
1550 | case Qt::Key_W: | 1550 | case Qt::Key_W: |
1551 | mView->viewManager()->showWhatsNextView(); | 1551 | mView->viewManager()->showWhatsNextView(); |
1552 | break; | 1552 | break; |
1553 | case Qt::Key_L: | 1553 | case Qt::Key_L: |
1554 | mView->viewManager()->showListView(); | 1554 | mView->viewManager()->showListView(); |
1555 | break; | 1555 | break; |
1556 | case Qt::Key_N: | 1556 | case Qt::Key_N: |
1557 | mView->viewManager()->showNextXView(); | 1557 | mView->viewManager()->showNextXView(); |
1558 | showSelectedDates = true; | 1558 | showSelectedDates = true; |
1559 | break; | 1559 | break; |
1560 | case Qt::Key_V: | 1560 | case Qt::Key_V: |
1561 | mView->viewManager()->showTodoView(); | 1561 | mView->viewManager()->showTodoView(); |
1562 | break; | 1562 | break; |
1563 | case Qt::Key_C: | 1563 | case Qt::Key_C: |
1564 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1564 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1565 | break; | 1565 | break; |
1566 | case Qt::Key_P: | 1566 | case Qt::Key_P: |
1567 | mView->showDatePicker( ); | 1567 | mView->showDatePicker( ); |
1568 | break; | 1568 | break; |
1569 | case Qt::Key_F: | 1569 | case Qt::Key_F: |
1570 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1570 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1571 | mView->editFilters(); | 1571 | mView->editFilters(); |
1572 | else | 1572 | else |
1573 | mView->toggleFilter(); | 1573 | mView->toggleFilter(); |
1574 | break; | 1574 | break; |
1575 | case Qt::Key_X: | 1575 | case Qt::Key_X: |
1576 | mView->toggleDateNavigatorWidget(); | 1576 | mView->toggleDateNavigatorWidget(); |
1577 | break; | 1577 | break; |
1578 | case Qt::Key_Space: | 1578 | case Qt::Key_Space: |
1579 | mView->toggleExpand(); | 1579 | mView->toggleExpand(); |