-rw-r--r-- | korganizer/mainwindow.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index f4ac0d6..7bf33d3 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -840,71 +840,71 @@ void MainWindow::initActions() | |||
840 | if (p-> mShowIconForward) | 840 | if (p-> mShowIconForward) |
841 | configureToolBarMenu->setItemChecked( 220, true ); | 841 | configureToolBarMenu->setItemChecked( 220, true ); |
842 | if (p-> mShowIconForwardFast) | 842 | if (p-> mShowIconForwardFast) |
843 | configureToolBarMenu->setItemChecked( 230, true ); | 843 | configureToolBarMenu->setItemChecked( 230, true ); |
844 | if (p-> mShowIconNextDays) | 844 | if (p-> mShowIconNextDays) |
845 | configureToolBarMenu->setItemChecked( 100, true ); | 845 | configureToolBarMenu->setItemChecked( 100, true ); |
846 | if (p-> mShowIconNext) | 846 | if (p-> mShowIconNext) |
847 | configureToolBarMenu->setItemChecked( 110, true ); | 847 | configureToolBarMenu->setItemChecked( 110, true ); |
848 | if (p-> mShowIconJournal) | 848 | if (p-> mShowIconJournal) |
849 | configureToolBarMenu->setItemChecked( 90, true ); | 849 | configureToolBarMenu->setItemChecked( 90, true ); |
850 | if (p-> mShowIconWhatsThis) | 850 | if (p-> mShowIconWhatsThis) |
851 | configureToolBarMenu->setItemChecked( 300, true ); | 851 | configureToolBarMenu->setItemChecked( 300, true ); |
852 | 852 | ||
853 | QLabel* dummy = new QLabel( iconToolBar ); | 853 | QLabel* dummy = new QLabel( iconToolBar ); |
854 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 854 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
855 | if (!p-> mShowIconStretch) | 855 | if (!p-> mShowIconStretch) |
856 | iconToolBar->setStretchableWidget ( dummy ) ; | 856 | iconToolBar->setStretchableWidget ( dummy ) ; |
857 | else | 857 | else |
858 | configureToolBarMenu->setItemChecked( 5, true ); | 858 | configureToolBarMenu->setItemChecked( 5, true ); |
859 | if (p-> mShowIconWhatsThis) | 859 | if (p-> mShowIconWhatsThis) |
860 | QWhatsThis::whatsThisButton ( iconToolBar ); | 860 | QWhatsThis::whatsThisButton ( iconToolBar ); |
861 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 861 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
862 | configureAgenda( p->mHourSize ); | 862 | configureAgenda( p->mHourSize ); |
863 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 863 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
864 | } | 864 | } |
865 | void MainWindow::fillSyncMenu() | 865 | void MainWindow::fillSyncMenu() |
866 | { | 866 | { |
867 | if ( syncMenu->count() ) | 867 | if ( syncMenu->count() ) |
868 | syncMenu->clear(); | 868 | syncMenu->clear(); |
869 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 869 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
870 | syncMenu->insertSeparator(); | 870 | syncMenu->insertSeparator(); |
871 | if ( mServerSocket == 0 ) { | 871 | if ( mServerSocket == 0 ) { |
872 | syncMenu->insertItem( i18n("Enable Easy-Pi-Sync"), 2 ); | 872 | syncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
873 | } else { | 873 | } else { |
874 | syncMenu->insertItem( i18n("Disable Easy-Pi-Sync"), 3 ); | 874 | syncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
875 | } | 875 | } |
876 | syncMenu->insertSeparator(); | 876 | syncMenu->insertSeparator(); |
877 | syncMenu->insertItem( i18n("New Easy-Pi-Sync!"), 4 ); | 877 | syncMenu->insertItem( i18n("New Pi-Sync!"), 4 ); |
878 | syncMenu->insertItem( i18n("Quick Easy-Pi-Sync!"), 5 ); | 878 | syncMenu->insertItem( i18n("Quick Pi-Sync!"), 5 ); |
879 | syncMenu->insertSeparator(); | 879 | syncMenu->insertSeparator(); |
880 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 880 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
881 | syncMenu->insertSeparator(); | 881 | syncMenu->insertSeparator(); |
882 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 882 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
883 | config.setGroup("General"); | 883 | config.setGroup("General"); |
884 | QStringList prof = config.readListEntry("SyncProfileNames"); | 884 | QStringList prof = config.readListEntry("SyncProfileNames"); |
885 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 885 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
886 | if ( prof.count() < 3 ) { | 886 | if ( prof.count() < 3 ) { |
887 | prof.clear(); | 887 | prof.clear(); |
888 | prof << i18n("Sharp_DTM"); | 888 | prof << i18n("Sharp_DTM"); |
889 | prof << i18n("Local_file"); | 889 | prof << i18n("Local_file"); |
890 | prof << i18n("Last_file"); | 890 | prof << i18n("Last_file"); |
891 | KSyncProfile* temp = new KSyncProfile (); | 891 | KSyncProfile* temp = new KSyncProfile (); |
892 | temp->setName( prof[0] ); | 892 | temp->setName( prof[0] ); |
893 | temp->writeConfig(&config); | 893 | temp->writeConfig(&config); |
894 | temp->setName( prof[1] ); | 894 | temp->setName( prof[1] ); |
895 | temp->writeConfig(&config); | 895 | temp->writeConfig(&config); |
896 | temp->setName( prof[2] ); | 896 | temp->setName( prof[2] ); |
897 | temp->writeConfig(&config); | 897 | temp->writeConfig(&config); |
898 | config.setGroup("General"); | 898 | config.setGroup("General"); |
899 | config.writeEntry("SyncProfileNames",prof); | 899 | config.writeEntry("SyncProfileNames",prof); |
900 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 900 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
901 | config.sync(); | 901 | config.sync(); |
902 | delete temp; | 902 | delete temp; |
903 | } | 903 | } |
904 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 904 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
905 | KOPrefs::instance()->mSyncProfileNames = prof; | 905 | KOPrefs::instance()->mSyncProfileNames = prof; |
906 | int i; | 906 | int i; |
907 | for ( i = 0; i < prof.count(); ++i ) { | 907 | for ( i = 0; i < prof.count(); ++i ) { |
908 | 908 | ||
909 | syncMenu->insertItem( prof[i], 1000+i ); | 909 | syncMenu->insertItem( prof[i], 1000+i ); |
910 | if ( i == 2 ) | 910 | if ( i == 2 ) |
@@ -1978,65 +1978,67 @@ void MainWindow::getFile(QSocket* socket) | |||
1978 | { | 1978 | { |
1979 | setCaption( i18n("Receiving synced file...") ); | 1979 | setCaption( i18n("Receiving synced file...") ); |
1980 | 1980 | ||
1981 | QString fileName = defaultFileName(); | 1981 | QString fileName = defaultFileName(); |
1982 | QFile file( fileName ); | 1982 | QFile file( fileName ); |
1983 | if (!file.open( IO_WriteOnly ) ) { | 1983 | if (!file.open( IO_WriteOnly ) ) { |
1984 | setCaption( i18n("Error open file") ); | 1984 | setCaption( i18n("Error open file") ); |
1985 | delete mSyncActionDialog; | 1985 | delete mSyncActionDialog; |
1986 | mSyncActionDialog = 0; | 1986 | mSyncActionDialog = 0; |
1987 | qDebug("error open cal file "); | 1987 | qDebug("error open cal file "); |
1988 | return ; | 1988 | return ; |
1989 | 1989 | ||
1990 | } | 1990 | } |
1991 | 1991 | ||
1992 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1992 | mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1993 | QTextStream ts( &file ); | 1993 | QTextStream ts( &file ); |
1994 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 1994 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
1995 | bool first = true; | 1995 | bool first = true; |
1996 | while ( socket->canReadLine () || first ) { | 1996 | while ( socket->canReadLine () || first ) { |
1997 | first = false; | 1997 | first = false; |
1998 | while ( socket->canReadLine () ) { | 1998 | while ( socket->canReadLine () ) { |
1999 | qDebug("avail %d ", socket->bytesAvailable () ); | 1999 | qDebug("avail %d ", socket->bytesAvailable () ); |
2000 | ts << socket->readLine (); | 2000 | ts << socket->readLine (); |
2001 | } | 2001 | } |
2002 | QTime ti; | 2002 | QTime ti; |
2003 | ti.start(); | 2003 | ti.start(); |
2004 | while ( ti.elapsed () < 5000 && !socket->canReadLine () ) { | 2004 | while ( ti.elapsed () < 5000 && !socket->canReadLine () ) { |
2005 | qDebug("waiting1a %d %d ",ti.elapsed (), socket->bytesAvailable () ); | 2005 | qDebug("waiting1a %d %d ",ti.elapsed (), socket->bytesAvailable () ); |
2006 | //qApp->processEvents(); | 2006 | //qApp->processEvents(); |
2007 | qDebug("waiting1b %d ",ti.elapsed () ); | 2007 | qDebug("waiting1b %d ",ti.elapsed () ); |
2008 | if ( !socket->canReadLine () ) { | 2008 | if ( !socket->canReadLine () ) { |
2009 | qDebug("waiting1c %d ",ti.elapsed () ); | 2009 | qDebug("waiting1c %d ",ti.elapsed () ); |
2010 | #ifndef _WIN32_ | ||
2010 | usleep( 100000); | 2011 | usleep( 100000); |
2012 | #endif | ||
2011 | } | 2013 | } |
2012 | //socket->waitForMore ( 100 ); | 2014 | //socket->waitForMore ( 100 ); |
2013 | } | 2015 | } |
2014 | ts << socket->readLine (); | 2016 | ts << socket->readLine (); |
2015 | #if 0 | 2017 | #if 0 |
2016 | #ifdef DESKTOP_VERSION | 2018 | #ifdef DESKTOP_VERSION |
2017 | socket->waitForMore ( 5000 ); | 2019 | socket->waitForMore ( 5000 ); |
2018 | #else | 2020 | #else |
2019 | // socket->waitForMore ( 5000 ); | 2021 | // socket->waitForMore ( 5000 ); |
2020 | // seems to be broken in qt2 | 2022 | // seems to be broken in qt2 |
2021 | bool stop = false; | 2023 | bool stop = false; |
2022 | QTime ti; | 2024 | QTime ti; |
2023 | ti.start(); | 2025 | ti.start(); |
2024 | while ( ti.elapsed < 5000 && !stop ) { | 2026 | while ( ti.elapsed < 5000 && !stop ) { |
2025 | qApp->processEvents(); | 2027 | qApp->processEvents(); |
2026 | if ( socket->canReadLine () ) | 2028 | if ( socket->canReadLine () ) |
2027 | stop = true ; | 2029 | stop = true ; |
2028 | else { | 2030 | else { |
2029 | usleep( 100000 ); | 2031 | usleep( 100000 ); |
2030 | 2032 | ||
2031 | } | 2033 | } |
2032 | } | 2034 | } |
2033 | #endif | 2035 | #endif |
2034 | #endif | 2036 | #endif |
2035 | } | 2037 | } |
2036 | setCaption( i18n("File received - reloading calendar...") ); | 2038 | setCaption( i18n("File received - reloading calendar...") ); |
2037 | socket->close(); | 2039 | socket->close(); |
2038 | file.close(); | 2040 | file.close(); |
2039 | mView->watchSavedFile(); | 2041 | mView->watchSavedFile(); |
2040 | mView->openCalendar( defaultFileName() ); | 2042 | mView->openCalendar( defaultFileName() ); |
2041 | setCaption( i18n("Easy-Pi-Sync successful!") ); | 2043 | setCaption( i18n("Easy-Pi-Sync successful!") ); |
2042 | delete mSyncActionDialog; | 2044 | delete mSyncActionDialog; |