author | zautrix <zautrix> | 2005-04-03 09:34:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-03 09:34:07 (UTC) |
commit | 4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c (patch) (unidiff) | |
tree | 369a243d3cb006d330686368d5397e264947e38e /libkdepim | |
parent | 4017b5fccc188c74e971c573dbb6154ce877807b (diff) | |
download | kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.zip kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.tar.gz kdepimpi-4f800d49800f8d0b1e7b0af8aacea6dbeb78e67c.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 184cb39..85a2aeb 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -848,172 +848,206 @@ bool KSyncManager::edit_sync_options() | |||
848 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 848 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
849 | return true; | 849 | return true; |
850 | } | 850 | } |
851 | return false; | 851 | return false; |
852 | } | 852 | } |
853 | 853 | ||
854 | QString KSyncManager::getPassword( ) | 854 | QString KSyncManager::getPassword( ) |
855 | { | 855 | { |
856 | QString retfile = ""; | 856 | QString retfile = ""; |
857 | QDialog dia ( mParent, "input-dialog", true ); | 857 | QDialog dia ( mParent, "input-dialog", true ); |
858 | QLineEdit lab ( &dia ); | 858 | QLineEdit lab ( &dia ); |
859 | lab.setEchoMode( QLineEdit::Password ); | 859 | lab.setEchoMode( QLineEdit::Password ); |
860 | QVBoxLayout lay( &dia ); | 860 | QVBoxLayout lay( &dia ); |
861 | lay.setMargin(7); | 861 | lay.setMargin(7); |
862 | lay.setSpacing(7); | 862 | lay.setSpacing(7); |
863 | lay.addWidget( &lab); | 863 | lay.addWidget( &lab); |
864 | dia.setFixedSize( 230,50 ); | 864 | dia.setFixedSize( 230,50 ); |
865 | dia.setCaption( i18n("Enter password") ); | 865 | dia.setCaption( i18n("Enter password") ); |
866 | QPushButton pb ( "OK", &dia); | 866 | QPushButton pb ( "OK", &dia); |
867 | lay.addWidget( &pb ); | 867 | lay.addWidget( &pb ); |
868 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 868 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
869 | dia.show(); | 869 | dia.show(); |
870 | int res = dia.exec(); | 870 | int res = dia.exec(); |
871 | if ( res ) | 871 | if ( res ) |
872 | retfile = lab.text(); | 872 | retfile = lab.text(); |
873 | dia.hide(); | 873 | dia.hide(); |
874 | qApp->processEvents(); | 874 | qApp->processEvents(); |
875 | return retfile; | 875 | return retfile; |
876 | 876 | ||
877 | } | 877 | } |
878 | 878 | ||
879 | 879 | ||
880 | void KSyncManager::confSync() | 880 | void KSyncManager::confSync() |
881 | { | 881 | { |
882 | static KSyncPrefsDialog* sp = 0; | 882 | static KSyncPrefsDialog* sp = 0; |
883 | if ( ! sp ) { | 883 | if ( ! sp ) { |
884 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 884 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
885 | } | 885 | } |
886 | sp->usrReadConfig(); | 886 | sp->usrReadConfig(); |
887 | #ifndef DESKTOP_VERSION | 887 | #ifndef DESKTOP_VERSION |
888 | sp->showMaximized(); | 888 | sp->showMaximized(); |
889 | #else | 889 | #else |
890 | sp->show(); | 890 | sp->show(); |
891 | #endif | 891 | #endif |
892 | sp->exec(); | 892 | sp->exec(); |
893 | QStringList oldSyncProfileNames = mSyncProfileNames; | 893 | QStringList oldSyncProfileNames = mSyncProfileNames; |
894 | mSyncProfileNames = sp->getSyncProfileNames(); | 894 | mSyncProfileNames = sp->getSyncProfileNames(); |
895 | mLocalMachineName = sp->getLocalMachineName (); | 895 | mLocalMachineName = sp->getLocalMachineName (); |
896 | int ii; | 896 | int ii; |
897 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | 897 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { |
898 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | 898 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) |
899 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | 899 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); |
900 | } | 900 | } |
901 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 901 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
902 | } | 902 | } |
903 | void KSyncManager::syncKDE() | 903 | void KSyncManager::syncKDE() |
904 | { | 904 | { |
905 | mSyncWithDesktop = true; | 905 | mSyncWithDesktop = true; |
906 | emit save(); | 906 | emit save(); |
907 | switch(mTargetApp) | 907 | switch(mTargetApp) |
908 | { | 908 | { |
909 | case (KAPI): | 909 | case (KAPI): |
910 | { | 910 | { |
911 | #ifdef DESKTOP_VERSION | 911 | #ifdef DESKTOP_VERSION |
912 | QString command = qApp->applicationDirPath () + "/kdeabdump"; | 912 | QString command = "kdeabdump33"; |
913 | QString commandfile = "kdeabdump33"; | ||
914 | QString commandpath = qApp->applicationDirPath () + "/"; | ||
913 | #else | 915 | #else |
914 | QString command = "kdeabdump"; | 916 | QString command = "kdeabdump33"; |
917 | QString commandfile = "kdeabdump33"; | ||
918 | QString commandpath = QDir::homeDirPath ()+"/"; | ||
915 | #endif | 919 | #endif |
916 | if ( ! QFile::exists ( command ) ) | 920 | if ( ! QFile::exists ( commandpath+commandfile ) ) |
917 | command = "kdeabdump"; | 921 | command = commandfile; |
922 | else | ||
923 | command = commandpath+commandfile; | ||
924 | |||
918 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; | 925 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; |
919 | int result = system ( command.latin1()); | 926 | int result = system ( command.latin1()); |
920 | qDebug("AB dump command call result: %d ", result); | 927 | qDebug("AB dump 33 command call result: %d ", result); |
921 | if ( result != 0 ) { | 928 | if ( result != 0 ) { |
922 | KMessageBox::error( 0, i18n("Error accessing KDE addressbook data.\nMake sure the file\n/opt/kdepimpi/kdeabdump\nexists.The standard version of this file\nis for syncing with KDE 3.4.x.\nIf you are running KDE 3.3.x please\ndownload the KDE 3.3.x version of this file\nat http://sourceforge.net/projects/kdepimpi/\nsection: general files for KDE/Pim.")); | 929 | qDebug("Calling AB dump version 33 failed. Trying 34... "); |
923 | return; | 930 | commandfile = "kdeabdump34"; |
931 | if ( ! QFile::exists ( commandpath+commandfile ) ) | ||
932 | command = commandfile; | ||
933 | else | ||
934 | command = commandpath+commandfile; | ||
935 | result = system ( command.latin1()); | ||
936 | qDebug("AB dump 34 command call result: %d ", result); | ||
937 | if ( result != 0 ) { | ||
938 | KMessageBox::error( 0, i18n("Error accessing KDE addressbook data.\nMake sure the file\n%1kdeabdump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath )); | ||
939 | return; | ||
940 | } | ||
924 | } | 941 | } |
925 | if ( syncWithFile( fileName,true ) ) { | 942 | if ( syncWithFile( fileName,true ) ) { |
926 | if ( mWriteBackFile ) { | 943 | if ( mWriteBackFile ) { |
927 | command += " --read"; | 944 | command += " --read"; |
928 | system ( command.latin1()); | 945 | system ( command.latin1()); |
929 | } | ||
930 | } | 946 | } |
947 | } | ||
931 | 948 | ||
932 | } | 949 | } |
933 | break; | 950 | break; |
934 | case (KOPI): | 951 | case (KOPI): |
935 | { | 952 | { |
936 | #ifdef DESKTOP_VERSION | 953 | #ifdef DESKTOP_VERSION |
937 | QString command = qApp->applicationDirPath () + "/kdecaldump"; | 954 | QString command = "kdecaldump33"; |
955 | QString commandfile = "kdecaldump33"; | ||
956 | QString commandpath = qApp->applicationDirPath () + "/"; | ||
938 | #else | 957 | #else |
939 | QString command = "kdecaldump"; | 958 | QString command = "kdecaldump33"; |
959 | QString commandfile = "kdecaldump33"; | ||
960 | QString commandpath = QDir::homeDirPath ()+"/"; | ||
940 | #endif | 961 | #endif |
941 | if ( ! QFile::exists ( command ) ) | 962 | if ( ! QFile::exists ( commandpath+commandfile ) ) |
942 | command = "kdecaldump"; | 963 | command = commandfile; |
964 | else | ||
965 | command = commandpath+commandfile; | ||
966 | |||
943 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | 967 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; |
944 | int result = system ( command.latin1()); | 968 | int result = system ( command.latin1()); |
945 | qDebug("Cal dump command call result result: %d ", result); | 969 | qDebug("Cal dump 33 command call result result: %d ", result); |
946 | if ( result != 0 ) { | 970 | if ( result != 0 ) { |
947 | KMessageBox::error( 0, i18n("Error accessing KDE calendar data.\nMake sure the file\n/opt/kdepimpi/kdecaldump\nexists.The standard version of this file\nis for syncing with KDE 3.4.x.\nIf you are running KDE 3.3.x please\ndownload the KDE 3.3.x version of this file\nat http://sourceforge.net/projects/kdepimpi/\nsection: general files for KDE/Pim.")); | 971 | qDebug("Calling CAL dump version 33 failed. Trying 34... "); |
948 | return; | 972 | commandfile = "kdecaldump34"; |
973 | if ( ! QFile::exists ( commandpath+commandfile ) ) | ||
974 | command = commandfile; | ||
975 | else | ||
976 | command = commandpath+commandfile; | ||
977 | result = system ( command.latin1()); | ||
978 | qDebug("Cal dump 34 command call result result: %d ", result); | ||
979 | if ( result != 0 ) { | ||
980 | KMessageBox::error( 0, i18n("Error accessing KDE calendar data.\nMake sure the file\n%1kdecaldump3x\nexists ( x = 3 or 4 ).\nSupported KDE versions are 3.3 and 3.4.\nUsed version should be auto detected.\n").arg( commandpath )); | ||
981 | return; | ||
982 | } | ||
949 | } | 983 | } |
950 | if ( syncWithFile( fileName,true ) ) { | 984 | if ( syncWithFile( fileName,true ) ) { |
951 | if ( mWriteBackFile ) { | 985 | if ( mWriteBackFile ) { |
952 | command += " --read"; | 986 | command += " --read"; |
953 | system ( command.latin1()); | 987 | system ( command.latin1()); |
954 | } | ||
955 | } | 988 | } |
989 | } | ||
956 | 990 | ||
957 | } | 991 | } |
958 | break; | 992 | break; |
959 | case (PWMPI): | 993 | case (PWMPI): |
960 | 994 | ||
961 | break; | 995 | break; |
962 | default: | 996 | default: |
963 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 997 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
964 | break; | 998 | break; |
965 | 999 | ||
966 | } | 1000 | } |
967 | } | 1001 | } |
968 | 1002 | ||
969 | void KSyncManager::syncSharp() | 1003 | void KSyncManager::syncSharp() |
970 | { | 1004 | { |
971 | 1005 | ||
972 | if ( ! syncExternalApplication("sharp") ) | 1006 | if ( ! syncExternalApplication("sharp") ) |
973 | qDebug("KSM::ERROR sync sharp "); | 1007 | qDebug("KSM::ERROR sync sharp "); |
974 | } | 1008 | } |
975 | 1009 | ||
976 | bool KSyncManager::syncExternalApplication(QString resource) | 1010 | bool KSyncManager::syncExternalApplication(QString resource) |
977 | { | 1011 | { |
978 | 1012 | ||
979 | emit save(); | 1013 | emit save(); |
980 | 1014 | ||
981 | if ( mAskForPreferences ) | 1015 | if ( mAskForPreferences ) |
982 | if ( !edit_sync_options()) { | 1016 | if ( !edit_sync_options()) { |
983 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1017 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
984 | return false; | 1018 | return false; |
985 | } | 1019 | } |
986 | 1020 | ||
987 | qDebug("KSM::Sync extern %s", resource.latin1()); | 1021 | qDebug("KSM::Sync extern %s", resource.latin1()); |
988 | 1022 | ||
989 | bool syncOK = mImplementation->syncExternal(this, resource); | 1023 | bool syncOK = mImplementation->syncExternal(this, resource); |
990 | 1024 | ||
991 | return syncOK; | 1025 | return syncOK; |
992 | 1026 | ||
993 | } | 1027 | } |
994 | 1028 | ||
995 | void KSyncManager::syncPhone() | 1029 | void KSyncManager::syncPhone() |
996 | { | 1030 | { |
997 | 1031 | ||
998 | syncExternalApplication("phone"); | 1032 | syncExternalApplication("phone"); |
999 | 1033 | ||
1000 | } | 1034 | } |
1001 | 1035 | ||
1002 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) | 1036 | void KSyncManager::showProgressBar(int percentage, QString caption, int total) |
1003 | { | 1037 | { |
1004 | if (!bar->isVisible()) | 1038 | if (!bar->isVisible()) |
1005 | { | 1039 | { |
1006 | int w = 300; | 1040 | int w = 300; |
1007 | if ( QApplication::desktop()->width() < 320 ) | 1041 | if ( QApplication::desktop()->width() < 320 ) |
1008 | w = 220; | 1042 | w = 220; |
1009 | int h = bar->sizeHint().height() ; | 1043 | int h = bar->sizeHint().height() ; |
1010 | int dw = QApplication::desktop()->width(); | 1044 | int dw = QApplication::desktop()->width(); |
1011 | int dh = QApplication::desktop()->height(); | 1045 | int dh = QApplication::desktop()->height(); |
1012 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1046 | bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1013 | bar->setCaption (caption); | 1047 | bar->setCaption (caption); |
1014 | bar->setTotalSteps ( total ) ; | 1048 | bar->setTotalSteps ( total ) ; |
1015 | bar->show(); | 1049 | bar->show(); |
1016 | } | 1050 | } |
1017 | bar->raise(); | 1051 | bar->raise(); |
1018 | bar->setProgress( percentage ); | 1052 | bar->setProgress( percentage ); |
1019 | qApp->processEvents(); | 1053 | qApp->processEvents(); |