summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e326a1..d8aa43a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -838,33 +838,34 @@ void MainWindow::initActions()
838 configureToolBarMenu->setItemChecked( 300, true ); 838 configureToolBarMenu->setItemChecked( 300, true );
839 839
840 QLabel* dummy = new QLabel( iconToolBar ); 840 QLabel* dummy = new QLabel( iconToolBar );
841 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 841 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
842 if (!p-> mShowIconStretch) 842 if (!p-> mShowIconStretch)
843 iconToolBar->setStretchableWidget ( dummy ) ; 843 iconToolBar->setStretchableWidget ( dummy ) ;
844 else 844 else
845 configureToolBarMenu->setItemChecked( 5, true ); 845 configureToolBarMenu->setItemChecked( 5, true );
846 if (p-> mShowIconWhatsThis) 846 if (p-> mShowIconWhatsThis)
847 QWhatsThis::whatsThisButton ( iconToolBar ); 847 QWhatsThis::whatsThisButton ( iconToolBar );
848 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 848 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
849 configureAgenda( p->mHourSize ); 849 configureAgenda( p->mHourSize );
850 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 850 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
851} 851}
852void MainWindow::fillSyncMenu() 852void MainWindow::fillSyncMenu()
853{ 853{
854 syncMenu->clear(); 854 if ( syncMenu->count() )
855 syncMenu->clear();
855 syncMenu->insertItem( i18n("Configure..."), 0 ); 856 syncMenu->insertItem( i18n("Configure..."), 0 );
856 syncMenu->insertSeparator(); 857 syncMenu->insertSeparator();
857 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 858 syncMenu->insertItem( i18n("Multiple sync"), 1 );
858 syncMenu->insertSeparator(); 859 syncMenu->insertSeparator();
859 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 860 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
860 config.setGroup("General"); 861 config.setGroup("General");
861 QStringList prof = config.readListEntry("SyncProfileNames"); 862 QStringList prof = config.readListEntry("SyncProfileNames");
862 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 863 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
863 if ( prof.count() < 3 ) { 864 if ( prof.count() < 3 ) {
864 prof.clear(); 865 prof.clear();
865 prof << i18n("Sharp_DTM"); 866 prof << i18n("Sharp_DTM");
866 prof << i18n("Local_file"); 867 prof << i18n("Local_file");
867 prof << i18n("Last_file"); 868 prof << i18n("Last_file");
868 KSyncProfile* temp = new KSyncProfile (); 869 KSyncProfile* temp = new KSyncProfile ();
869 temp->setName( prof[0] ); 870 temp->setName( prof[0] );
870 temp->writeConfig(&config); 871 temp->writeConfig(&config);
@@ -975,33 +976,38 @@ void MainWindow::multiSync( bool askforPrefs )
975 if ( num > 1 ) 976 if ( num > 1 )
976 ringSync(); 977 ringSync();
977 mBlockSaveFlag = false; 978 mBlockSaveFlag = false;
978 if ( num ) 979 if ( num )
979 save(); 980 save();
980 if ( num ) 981 if ( num )
981 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 982 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
982 else 983 else
983 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 984 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
984 return; 985 return;
985} 986}
986void MainWindow::slotSyncMenu( int action ) 987void MainWindow::slotSyncMenu( int action )
987{ 988{
988 //qDebug("syncaction %d ", action); 989 //qDebug("syncaction %d ", action);
989 if ( action == 0 ) { 990 if ( action == 0 ) {
990 991
991 confSync(); 992 // seems to be a Qt2 event handling bug
993 // syncmenu.clear causes a segfault at first time
994 // when we call it after the main event loop, it is ok
995 // same behaviour when calling OM/Pi via QCOP for the first time
996 QTimer::singleShot ( 1, this, SLOT ( confSync() ) );
997 //confSync();
992 998
993 return; 999 return;
994 } 1000 }
995 if ( action == 1 ) { 1001 if ( action == 1 ) {
996 multiSync( true ); 1002 multiSync( true );
997 return; 1003 return;
998 } 1004 }
999 1005
1000 if (mBlockSaveFlag) 1006 if (mBlockSaveFlag)
1001 return; 1007 return;
1002 mBlockSaveFlag = true; 1008 mBlockSaveFlag = true;
1003 mCurrentSyncProfile = action - 1000 ; 1009 mCurrentSyncProfile = action - 1000 ;
1004 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 1010 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
1005 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 1011 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
1006 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 1012 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
1007 KSyncProfile* temp = new KSyncProfile (); 1013 KSyncProfile* temp = new KSyncProfile ();
@@ -1899,35 +1905,32 @@ void MainWindow::quickSyncLocalFile()
1899{ 1905{
1900 //mView->setSyncDevice("local-file" ); 1906 //mView->setSyncDevice("local-file" );
1901 //qDebug("quickSyncLocalFile() "); 1907 //qDebug("quickSyncLocalFile() ");
1902 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { 1908 if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) {
1903 // Event* e = mView->getLastSyncEvent(); 1909 // Event* e = mView->getLastSyncEvent();
1904// e->setReadOnly( false ); 1910// e->setReadOnly( false );
1905// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); 1911// e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile);
1906// e->setReadOnly( true ); 1912// e->setReadOnly( true );
1907 1913
1908 } 1914 }
1909} 1915}
1910 1916
1911void MainWindow::confSync() 1917void MainWindow::confSync()
1912{ 1918{
1913 mView->confSync(); 1919 mView->confSync();
1914 fillSyncMenu(); 1920 fillSyncMenu();
1915 //mView->writeSettings();
1916
1917
1918} 1921}
1919void MainWindow::syncRemote( KSyncProfile* prof, bool ask) 1922void MainWindow::syncRemote( KSyncProfile* prof, bool ask)
1920{ 1923{
1921 QString question; 1924 QString question;
1922 if ( ask ) { 1925 if ( ask ) {
1923 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 1926 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
1924 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 1927 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
1925 question, 1928 question,
1926 i18n("Yes"), i18n("No"), 1929 i18n("Yes"), i18n("No"),
1927 0, 0 ) != 0 ) 1930 0, 0 ) != 0 )
1928 return; 1931 return;
1929 } 1932 }
1930 QString command = prof->getPreSyncCommand(); 1933 QString command = prof->getPreSyncCommand();
1931 int fi; 1934 int fi;
1932 if ( (fi = command.find("$PWD$")) > 0 ) { 1935 if ( (fi = command.find("$PWD$")) > 0 ) {
1933 QString pwd = getPassword(); 1936 QString pwd = getPassword();