-rw-r--r-- | libkdepim/categoryeditdialog.h | 4 | ||||
-rw-r--r-- | libkdepim/categoryselectdialog.cpp | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 9 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/libkdepim/categoryeditdialog.h b/libkdepim/categoryeditdialog.h index 3e8ab45..9bb3201 100644 --- a/libkdepim/categoryeditdialog.h +++ b/libkdepim/categoryeditdialog.h | |||
@@ -1,86 +1,86 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KPIM_CATEGORYEDITDIALOG_H | 23 | #ifndef KPIM_CATEGORYEDITDIALOG_H |
24 | #define KPIM_CATEGORYEDITDIALOG_H | 24 | #define KPIM_CATEGORYEDITDIALOG_H |
25 | 25 | ||
26 | #include <categoryeditdialog_base.h> | 26 | #include <categoryeditdialog_base.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | 28 | ||
29 | class KPimPrefs; | 29 | class KPimPrefs; |
30 | 30 | ||
31 | namespace KPIM { | 31 | namespace KPIM { |
32 | 32 | ||
33 | class CategorySelectItem :public QObject, public QCheckListItem | 33 | class CategorySelectItem :public QObject, public QCheckListItem |
34 | { | 34 | { |
35 | 35 | ||
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | 38 | ||
39 | CategorySelectItem(QListView * parent, const QString & text, Type tt) : | 39 | CategorySelectItem(QListView * parent, const QString & text, Type tt) : QObject( parent ), |
40 | QCheckListItem (parent, text, tt ) , QObject( parent ) | 40 | QCheckListItem (parent, text, tt ) |
41 | {;} | 41 | {;} |
42 | 42 | ||
43 | signals: | 43 | signals: |
44 | void stateChanged( QListViewItem*); | 44 | void stateChanged( QListViewItem*); |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | 47 | ||
48 | virtual void stateChange(bool b) | 48 | virtual void stateChange(bool b) |
49 | { | 49 | { |
50 | QCheckListItem::stateChange(b); | 50 | QCheckListItem::stateChange(b); |
51 | emit stateChanged( this ); | 51 | emit stateChanged( this ); |
52 | } | 52 | } |
53 | }; | 53 | }; |
54 | 54 | ||
55 | 55 | ||
56 | class CategoryEditDialog : public CategoryEditDialog_base | 56 | class CategoryEditDialog : public CategoryEditDialog_base |
57 | { | 57 | { |
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | public: | 59 | public: |
60 | CategoryEditDialog( KPimPrefs *prefs, QWidget* parent = 0, | 60 | CategoryEditDialog( KPimPrefs *prefs, QWidget* parent = 0, |
61 | const char* name = 0, | 61 | const char* name = 0, |
62 | bool modal = FALSE, WFlags fl = 0 ); | 62 | bool modal = FALSE, WFlags fl = 0 ); |
63 | ~CategoryEditDialog(); | 63 | ~CategoryEditDialog(); |
64 | 64 | ||
65 | public slots: | 65 | public slots: |
66 | void add(); | 66 | void add(); |
67 | void remove(); | 67 | void remove(); |
68 | void modify(); | 68 | void modify(); |
69 | void accept(); | 69 | void accept(); |
70 | 70 | ||
71 | void slotOk(); | 71 | void slotOk(); |
72 | void slotApply(); | 72 | void slotApply(); |
73 | 73 | ||
74 | signals: | 74 | signals: |
75 | void categoryConfigChanged(); | 75 | void categoryConfigChanged(); |
76 | 76 | ||
77 | private slots: | 77 | private slots: |
78 | void editItem(QListViewItem *item); | 78 | void editItem(QListViewItem *item); |
79 | void slotTextChanged(const QString &text); | 79 | void slotTextChanged(const QString &text); |
80 | 80 | ||
81 | KPimPrefs *mPrefs; | 81 | KPimPrefs *mPrefs; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | #endif | 86 | #endif |
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index a4e0024..2a9b43e 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -1,92 +1,93 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000, 2001, 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlistview.h> | 24 | #include <qlistview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qheader.h> | 26 | #include <qheader.h> |
27 | #include <qapp.h> | 27 | #include <qapp.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <kmessagebox.h> | 29 | #include <kmessagebox.h> |
30 | 30 | ||
31 | 31 | ||
32 | #include "categoryeditdialog.h" | 32 | #include "categoryeditdialog.h" |
33 | #include "categoryselectdialog.h" | 33 | #include "categoryselectdialog.h" |
34 | 34 | ||
35 | #include "kpimprefs.h" | 35 | #include "kpimprefs.h" |
36 | 36 | ||
37 | using namespace KPIM; | 37 | using namespace KPIM; |
38 | 38 | ||
39 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, | 39 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, |
40 | const char* name, | 40 | const char* name, |
41 | bool modal, WFlags fl ) | 41 | bool modal, WFlags fl ) |
42 | : CategorySelectDialog_base( parent, name, true, fl ), | 42 | : CategorySelectDialog_base( parent, name, true, fl ), |
43 | mPrefs( prefs ) | 43 | mPrefs( prefs ) |
44 | { | 44 | { |
45 | Q_UNUSED( modal ); | ||
45 | mColorItem = 0; | 46 | mColorItem = 0; |
46 | mColorEnabled = false; | 47 | mColorEnabled = false; |
47 | mCategories->header()->hide(); | 48 | mCategories->header()->hide(); |
48 | 49 | ||
49 | setCategories(); | 50 | setCategories(); |
50 | 51 | ||
51 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); | 52 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); |
52 | if ( QApplication::desktop()->width() > 460 ) | 53 | if ( QApplication::desktop()->width() > 460 ) |
53 | resize( 300, 360 ); | 54 | resize( 300, 360 ); |
54 | else | 55 | else |
55 | showMaximized(); | 56 | showMaximized(); |
56 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); | 57 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); |
57 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 58 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); |
58 | #ifndef DESKTOP_VERSION | 59 | #ifndef DESKTOP_VERSION |
59 | mButtonOk->hide(); | 60 | mButtonOk->hide(); |
60 | mButtonCancel->hide(); | 61 | mButtonCancel->hide(); |
61 | #endif | 62 | #endif |
62 | } | 63 | } |
63 | void CategorySelectDialog::editCategoriesDialog() | 64 | void CategorySelectDialog::editCategoriesDialog() |
64 | { | 65 | { |
65 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); | 66 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); |
66 | 67 | ||
67 | ced->exec(); | 68 | ced->exec(); |
68 | delete ced; | 69 | delete ced; |
69 | slotApply(); | 70 | slotApply(); |
70 | QStringList temp = mCategoryList; | 71 | QStringList temp = mCategoryList; |
71 | setCategories(); | 72 | setCategories(); |
72 | setSelected( temp ); | 73 | setSelected( temp ); |
73 | } | 74 | } |
74 | void CategorySelectDialog::setCategories() | 75 | void CategorySelectDialog::setCategories() |
75 | { | 76 | { |
76 | mColorItem = 0; | 77 | mColorItem = 0; |
77 | mCategories->clear(); | 78 | mCategories->clear(); |
78 | mCategoryList.clear(); | 79 | mCategoryList.clear(); |
79 | 80 | ||
80 | QStringList::Iterator it; | 81 | QStringList::Iterator it; |
81 | for (it = mPrefs->mCustomCategories.begin(); | 82 | for (it = mPrefs->mCustomCategories.begin(); |
82 | it != mPrefs->mCustomCategories.end(); ++it ) { | 83 | it != mPrefs->mCustomCategories.end(); ++it ) { |
83 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); | 84 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); |
84 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 85 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); |
85 | 86 | ||
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
89 | CategorySelectDialog::~CategorySelectDialog() | 90 | CategorySelectDialog::~CategorySelectDialog() |
90 | { | 91 | { |
91 | } | 92 | } |
92 | 93 | ||
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 0109c02..28c48fe 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -708,97 +708,96 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
708 | { | 708 | { |
709 | QString question; | 709 | QString question; |
710 | if ( ask ) { | 710 | if ( ask ) { |
711 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 711 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
712 | if ( QMessageBox::information( mParent, i18n("Sync"), | 712 | if ( QMessageBox::information( mParent, i18n("Sync"), |
713 | question, | 713 | question, |
714 | i18n("Yes"), i18n("No"), | 714 | i18n("Yes"), i18n("No"), |
715 | 0, 0 ) != 0 ) | 715 | 0, 0 ) != 0 ) |
716 | return; | 716 | return; |
717 | } | 717 | } |
718 | 718 | ||
719 | QString preCommand; | 719 | QString preCommand; |
720 | QString localTempFile; | 720 | QString localTempFile; |
721 | QString postCommand; | 721 | QString postCommand; |
722 | 722 | ||
723 | switch(mTargetApp) | 723 | switch(mTargetApp) |
724 | { | 724 | { |
725 | case (KAPI): | 725 | case (KAPI): |
726 | preCommand = prof->getPreSyncCommandAB(); | 726 | preCommand = prof->getPreSyncCommandAB(); |
727 | postCommand = prof->getPostSyncCommandAB(); | 727 | postCommand = prof->getPostSyncCommandAB(); |
728 | localTempFile = prof->getLocalTempFileAB(); | 728 | localTempFile = prof->getLocalTempFileAB(); |
729 | break; | 729 | break; |
730 | case (KOPI): | 730 | case (KOPI): |
731 | preCommand = prof->getPreSyncCommand(); | 731 | preCommand = prof->getPreSyncCommand(); |
732 | postCommand = prof->getPostSyncCommand(); | 732 | postCommand = prof->getPostSyncCommand(); |
733 | localTempFile = prof->getLocalTempFile(); | 733 | localTempFile = prof->getLocalTempFile(); |
734 | break; | 734 | break; |
735 | case (PWMPI): | 735 | case (PWMPI): |
736 | preCommand = prof->getPreSyncCommandPWM(); | 736 | preCommand = prof->getPreSyncCommandPWM(); |
737 | postCommand = prof->getPostSyncCommandPWM(); | 737 | postCommand = prof->getPostSyncCommandPWM(); |
738 | localTempFile = prof->getLocalTempFilePWM(); | 738 | localTempFile = prof->getLocalTempFilePWM(); |
739 | break; | 739 | break; |
740 | default: | 740 | default: |
741 | qDebug("KSM::syncRemote: invalid apptype selected"); | 741 | qDebug("KSM::syncRemote: invalid apptype selected"); |
742 | break; | 742 | break; |
743 | } | 743 | } |
744 | 744 | ||
745 | 745 | ||
746 | int fi; | 746 | int fi; |
747 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 747 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
748 | QString pwd = getPassword(); | 748 | QString pwd = getPassword(); |
749 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 749 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
750 | 750 | ||
751 | } | 751 | } |
752 | int maxlen = 30; | 752 | int maxlen = 30; |
753 | if ( QApplication::desktop()->width() > 320 ) | 753 | if ( QApplication::desktop()->width() > 320 ) |
754 | maxlen += 25; | 754 | maxlen += 25; |
755 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 755 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
756 | int fileSize = 0; | ||
757 | int result = system ( preCommand ); | 756 | int result = system ( preCommand ); |
758 | // 0 : okay | 757 | // 0 : okay |
759 | // 256: no such file or dir | 758 | // 256: no such file or dir |
760 | // | 759 | // |
761 | qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); | 760 | qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); |
762 | if ( result != 0 ) { | 761 | if ( result != 0 ) { |
763 | unsigned int len = maxlen; | 762 | unsigned int len = maxlen; |
764 | while ( len < preCommand.length() ) { | 763 | while ( len < preCommand.length() ) { |
765 | preCommand.insert( len , "\n" ); | 764 | preCommand.insert( len , "\n" ); |
766 | len += maxlen +2; | 765 | len += maxlen +2; |
767 | } | 766 | } |
768 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; | 767 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; |
769 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 768 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
770 | question, | 769 | question, |
771 | i18n("Okay!")) ; | 770 | i18n("Okay!")) ; |
772 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); | 771 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
773 | return; | 772 | return; |
774 | } | 773 | } |
775 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 774 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
776 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 775 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
777 | 776 | ||
778 | if ( syncWithFile( localTempFile, true ) ) { | 777 | if ( syncWithFile( localTempFile, true ) ) { |
779 | 778 | ||
780 | if ( mWriteBackFile ) { | 779 | if ( mWriteBackFile ) { |
781 | int fi; | 780 | int fi; |
782 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 781 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
783 | QString pwd = getPassword(); | 782 | QString pwd = getPassword(); |
784 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 783 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
785 | 784 | ||
786 | } | 785 | } |
787 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); | 786 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); |
788 | result = system ( postCommand ); | 787 | result = system ( postCommand ); |
789 | qDebug("KSM::Sync:Writing back file result: %d ", result); | 788 | qDebug("KSM::Sync:Writing back file result: %d ", result); |
790 | if ( result != 0 ) { | 789 | if ( result != 0 ) { |
791 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 790 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
792 | return; | 791 | return; |
793 | } else { | 792 | } else { |
794 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 793 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
795 | } | 794 | } |
796 | } | 795 | } |
797 | } | 796 | } |
798 | return; | 797 | return; |
799 | } | 798 | } |
800 | bool KSyncManager::edit_pisync_options() | 799 | bool KSyncManager::edit_pisync_options() |
801 | { | 800 | { |
802 | QDialog dia( mParent, "dia", true ); | 801 | QDialog dia( mParent, "dia", true ); |
803 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); | 802 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); |
804 | QVBoxLayout lay ( &dia ); | 803 | QVBoxLayout lay ( &dia ); |
@@ -879,97 +878,97 @@ bool KSyncManager::edit_sync_options() | |||
879 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 878 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
880 | return true; | 879 | return true; |
881 | } | 880 | } |
882 | return false; | 881 | return false; |
883 | } | 882 | } |
884 | 883 | ||
885 | QString KSyncManager::getPassword( ) | 884 | QString KSyncManager::getPassword( ) |
886 | { | 885 | { |
887 | QString retfile = ""; | 886 | QString retfile = ""; |
888 | QDialog dia ( mParent, "input-dialog", true ); | 887 | QDialog dia ( mParent, "input-dialog", true ); |
889 | QLineEdit lab ( &dia ); | 888 | QLineEdit lab ( &dia ); |
890 | lab.setEchoMode( QLineEdit::Password ); | 889 | lab.setEchoMode( QLineEdit::Password ); |
891 | QVBoxLayout lay( &dia ); | 890 | QVBoxLayout lay( &dia ); |
892 | lay.setMargin(7); | 891 | lay.setMargin(7); |
893 | lay.setSpacing(7); | 892 | lay.setSpacing(7); |
894 | lay.addWidget( &lab); | 893 | lay.addWidget( &lab); |
895 | dia.setFixedSize( 230,50 ); | 894 | dia.setFixedSize( 230,50 ); |
896 | dia.setCaption( i18n("Enter password") ); | 895 | dia.setCaption( i18n("Enter password") ); |
897 | QPushButton pb ( "OK", &dia); | 896 | QPushButton pb ( "OK", &dia); |
898 | lay.addWidget( &pb ); | 897 | lay.addWidget( &pb ); |
899 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 898 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
900 | dia.show(); | 899 | dia.show(); |
901 | int res = dia.exec(); | 900 | int res = dia.exec(); |
902 | if ( res ) | 901 | if ( res ) |
903 | retfile = lab.text(); | 902 | retfile = lab.text(); |
904 | dia.hide(); | 903 | dia.hide(); |
905 | qApp->processEvents(); | 904 | qApp->processEvents(); |
906 | return retfile; | 905 | return retfile; |
907 | 906 | ||
908 | } | 907 | } |
909 | 908 | ||
910 | 909 | ||
911 | void KSyncManager::confSync() | 910 | void KSyncManager::confSync() |
912 | { | 911 | { |
913 | static KSyncPrefsDialog* sp = 0; | 912 | static KSyncPrefsDialog* sp = 0; |
914 | if ( ! sp ) { | 913 | if ( ! sp ) { |
915 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 914 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
916 | } | 915 | } |
917 | sp->usrReadConfig(); | 916 | sp->usrReadConfig(); |
918 | #ifndef DESKTOP_VERSION | 917 | #ifndef DESKTOP_VERSION |
919 | sp->showMaximized(); | 918 | sp->showMaximized(); |
920 | #else | 919 | #else |
921 | sp->show(); | 920 | sp->show(); |
922 | #endif | 921 | #endif |
923 | sp->exec(); | 922 | sp->exec(); |
924 | QStringList oldSyncProfileNames = mSyncProfileNames; | 923 | QStringList oldSyncProfileNames = mSyncProfileNames; |
925 | mSyncProfileNames = sp->getSyncProfileNames(); | 924 | mSyncProfileNames = sp->getSyncProfileNames(); |
926 | mLocalMachineName = sp->getLocalMachineName (); | 925 | mLocalMachineName = sp->getLocalMachineName (); |
927 | int ii; | 926 | uint ii; |
928 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | 927 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { |
929 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | 928 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) |
930 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | 929 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); |
931 | } | 930 | } |
932 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 931 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
933 | } | 932 | } |
934 | void KSyncManager::syncKDE() | 933 | void KSyncManager::syncKDE() |
935 | { | 934 | { |
936 | mSyncWithDesktop = true; | 935 | mSyncWithDesktop = true; |
937 | emit save(); | 936 | emit save(); |
938 | switch(mTargetApp) | 937 | switch(mTargetApp) |
939 | { | 938 | { |
940 | case (KAPI): | 939 | case (KAPI): |
941 | { | 940 | { |
942 | #ifdef DESKTOP_VERSION | 941 | #ifdef DESKTOP_VERSION |
943 | QString command = "kdeabdump33"; | 942 | QString command = "kdeabdump33"; |
944 | QString commandfile = "kdeabdump33"; | 943 | QString commandfile = "kdeabdump33"; |
945 | QString commandpath = qApp->applicationDirPath () + "/"; | 944 | QString commandpath = qApp->applicationDirPath () + "/"; |
946 | #else | 945 | #else |
947 | QString command = "kdeabdump33"; | 946 | QString command = "kdeabdump33"; |
948 | QString commandfile = "kdeabdump33"; | 947 | QString commandfile = "kdeabdump33"; |
949 | QString commandpath = QDir::homeDirPath ()+"/"; | 948 | QString commandpath = QDir::homeDirPath ()+"/"; |
950 | #endif | 949 | #endif |
951 | if ( ! QFile::exists ( commandpath+commandfile ) ) | 950 | if ( ! QFile::exists ( commandpath+commandfile ) ) |
952 | command = commandfile; | 951 | command = commandfile; |
953 | else | 952 | else |
954 | command = commandpath+commandfile; | 953 | command = commandpath+commandfile; |
955 | 954 | ||
956 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; | 955 | QString fileName = QDir::homeDirPath ()+"/.kdeaddressbookdump.vcf"; |
957 | int result = system ( command.latin1()); | 956 | int result = system ( command.latin1()); |
958 | qDebug("AB dump 33 command call result: %d ", result); | 957 | qDebug("AB dump 33 command call result: %d ", result); |
959 | if ( result != 0 ) { | 958 | if ( result != 0 ) { |
960 | qDebug("Calling AB dump version 33 failed. Trying 34... "); | 959 | qDebug("Calling AB dump version 33 failed. Trying 34... "); |
961 | commandfile = "kdeabdump34"; | 960 | commandfile = "kdeabdump34"; |
962 | if ( ! QFile::exists ( commandpath+commandfile ) ) | 961 | if ( ! QFile::exists ( commandpath+commandfile ) ) |
963 | command = commandfile; | 962 | command = commandfile; |
964 | else | 963 | else |
965 | command = commandpath+commandfile; | 964 | command = commandpath+commandfile; |
966 | result = system ( command.latin1()); | 965 | result = system ( command.latin1()); |
967 | qDebug("AB dump 34 command call result: %d ", result); | 966 | qDebug("AB dump 34 command call result: %d ", result); |
968 | if ( result != 0 ) { | 967 | if ( result != 0 ) { |
969 | 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 )); | 968 | 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 )); |
970 | return; | 969 | return; |
971 | } | 970 | } |
972 | } | 971 | } |
973 | if ( syncWithFile( fileName,true ) ) { | 972 | if ( syncWithFile( fileName,true ) ) { |
974 | if ( mWriteBackFile ) { | 973 | if ( mWriteBackFile ) { |
975 | command += " --read"; | 974 | command += " --read"; |
@@ -1096,105 +1095,105 @@ bool KSyncManager::isProgressBarCanceled() | |||
1096 | } | 1095 | } |
1097 | 1096 | ||
1098 | QString KSyncManager::syncFileName() | 1097 | QString KSyncManager::syncFileName() |
1099 | { | 1098 | { |
1100 | 1099 | ||
1101 | QString fn = "tempfile"; | 1100 | QString fn = "tempfile"; |
1102 | switch(mTargetApp) | 1101 | switch(mTargetApp) |
1103 | { | 1102 | { |
1104 | case (KAPI): | 1103 | case (KAPI): |
1105 | fn = "tempsyncab.vcf"; | 1104 | fn = "tempsyncab.vcf"; |
1106 | break; | 1105 | break; |
1107 | case (KOPI): | 1106 | case (KOPI): |
1108 | fn = "tempsynccal.ics"; | 1107 | fn = "tempsynccal.ics"; |
1109 | break; | 1108 | break; |
1110 | case (PWMPI): | 1109 | case (PWMPI): |
1111 | fn = "tempsyncpw.pwm"; | 1110 | fn = "tempsyncpw.pwm"; |
1112 | break; | 1111 | break; |
1113 | default: | 1112 | default: |
1114 | break; | 1113 | break; |
1115 | } | 1114 | } |
1116 | #ifdef DESKTOP_VERSION | 1115 | #ifdef DESKTOP_VERSION |
1117 | return locateLocal( "tmp", fn ); | 1116 | return locateLocal( "tmp", fn ); |
1118 | #else | 1117 | #else |
1119 | return (QString( "/tmp/" )+ fn ); | 1118 | return (QString( "/tmp/" )+ fn ); |
1120 | #endif | 1119 | #endif |
1121 | } | 1120 | } |
1122 | 1121 | ||
1123 | void KSyncManager::syncPi() | 1122 | void KSyncManager::syncPi() |
1124 | { | 1123 | { |
1125 | mIsKapiFile = true; | 1124 | mIsKapiFile = true; |
1126 | mPisyncFinished = false; | 1125 | mPisyncFinished = false; |
1127 | qApp->processEvents(); | 1126 | qApp->processEvents(); |
1128 | if ( mAskForPreferences ) | 1127 | if ( mAskForPreferences ) |
1129 | if ( !edit_pisync_options()) { | 1128 | if ( !edit_pisync_options()) { |
1130 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 1129 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
1131 | mPisyncFinished = true; | 1130 | mPisyncFinished = true; |
1132 | return; | 1131 | return; |
1133 | } | 1132 | } |
1134 | bool ok; | 1133 | bool ok; |
1135 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1134 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1136 | if ( ! ok ) { | 1135 | if ( ! ok ) { |
1137 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1136 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1138 | mPisyncFinished = true; | 1137 | mPisyncFinished = true; |
1139 | return; | 1138 | return; |
1140 | } | 1139 | } |
1141 | mCurrentResourceLocal = ""; | 1140 | mCurrentResourceLocal = ""; |
1142 | mCurrentResourceRemote = ""; | 1141 | mCurrentResourceRemote = ""; |
1143 | if ( mSpecificResources.count() ) { | 1142 | if ( mSpecificResources.count() ) { |
1144 | int lastSyncRes = mSpecificResources.count()/2; | 1143 | uint lastSyncRes = mSpecificResources.count()/2; |
1145 | int ccc = mSpecificResources.count()-1; | 1144 | int ccc = mSpecificResources.count()-1; |
1146 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { | 1145 | while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { |
1147 | --ccc; | 1146 | --ccc; |
1148 | --lastSyncRes; | 1147 | --lastSyncRes; |
1149 | //qDebug ( "KSM: sync pi %d",ccc ); | 1148 | //qDebug ( "KSM: sync pi %d",ccc ); |
1150 | } | 1149 | } |
1151 | int startLocal = 0; | 1150 | uint startLocal = 0; |
1152 | int startRemote = mSpecificResources.count()/2; | 1151 | uint startRemote = mSpecificResources.count()/2; |
1153 | emit multiResourceSyncStart( true ); | 1152 | emit multiResourceSyncStart( true ); |
1154 | while ( startLocal < mSpecificResources.count()/2 ) { | 1153 | while ( startLocal < mSpecificResources.count()/2 ) { |
1155 | if ( startLocal+1 >= lastSyncRes ) | 1154 | if ( startLocal+1 >= lastSyncRes ) |
1156 | emit multiResourceSyncStart( false ); | 1155 | emit multiResourceSyncStart( false ); |
1157 | mPisyncFinished = false; | 1156 | mPisyncFinished = false; |
1158 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; | 1157 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; |
1159 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; | 1158 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; |
1160 | //qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | 1159 | //qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); |
1161 | if ( !mCurrentResourceRemote.isEmpty() ) { | 1160 | if ( !mCurrentResourceRemote.isEmpty() ) { |
1162 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); | 1161 | qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); |
1163 | 1162 | ||
1164 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1163 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1165 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1164 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1166 | commandSocket->readFile( syncFileName() ); | 1165 | commandSocket->readFile( syncFileName() ); |
1167 | mParent->topLevelWidget()->setCaption( i18n("Syncing %1 <-> %2").arg( mCurrentResourceLocal ).arg( mCurrentResourceRemote ) ); | 1166 | mParent->topLevelWidget()->setCaption( i18n("Syncing %1 <-> %2").arg( mCurrentResourceLocal ).arg( mCurrentResourceRemote ) ); |
1168 | while ( !mPisyncFinished ) { | 1167 | while ( !mPisyncFinished ) { |
1169 | //qDebug("waiting "); | 1168 | //qDebug("waiting "); |
1170 | qApp->processEvents(); | 1169 | qApp->processEvents(); |
1171 | } | 1170 | } |
1172 | if ( startLocal+1 < mSpecificResources.count()/2 ) { | 1171 | if ( startLocal+1 < mSpecificResources.count()/2 ) { |
1173 | mParent->topLevelWidget()->setCaption( i18n("Waiting 2 secs before syncing next resource...") ); | 1172 | mParent->topLevelWidget()->setCaption( i18n("Waiting 2 secs before syncing next resource...") ); |
1174 | QTime timer; | 1173 | QTime timer; |
1175 | timer.start(); | 1174 | timer.start(); |
1176 | while ( timer.elapsed () < 2000 ) { | 1175 | while ( timer.elapsed () < 2000 ) { |
1177 | qApp->processEvents(); | 1176 | qApp->processEvents(); |
1178 | } | 1177 | } |
1179 | } | 1178 | } |
1180 | } | 1179 | } |
1181 | ++startRemote; | 1180 | ++startRemote; |
1182 | ++startLocal; | 1181 | ++startLocal; |
1183 | mAskForPreferences = false; | 1182 | mAskForPreferences = false; |
1184 | } | 1183 | } |
1185 | mPisyncFinished = true; | 1184 | mPisyncFinished = true; |
1186 | } else { | 1185 | } else { |
1187 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1186 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1188 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1187 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1189 | commandSocket->readFile( syncFileName() ); | 1188 | commandSocket->readFile( syncFileName() ); |
1190 | } | 1189 | } |
1191 | } | 1190 | } |
1192 | 1191 | ||
1193 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1192 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1194 | { | 1193 | { |
1195 | //enum { success, errorW, errorR, quiet }; | 1194 | //enum { success, errorW, errorR, quiet }; |
1196 | 1195 | ||
1197 | 1196 | ||
1198 | 1197 | ||
1199 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || | 1198 | if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ||state == KCommandSocket::errorPW || |
1200 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { | 1199 | state == KCommandSocket::errorCA ||state == KCommandSocket::errorFI ||state == KCommandSocket::errorUN||state == KCommandSocket::errorED ) { |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 604adb8..04cdade 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -190,60 +190,60 @@ class KSyncManager : public QObject | |||
190 | void readFileFromSocket(); | 190 | void readFileFromSocket(); |
191 | void fillSyncMenu(); | 191 | void fillSyncMenu(); |
192 | 192 | ||
193 | private: | 193 | private: |
194 | void syncPi(); | 194 | void syncPi(); |
195 | KServerSocket * mServerSocket; | 195 | KServerSocket * mServerSocket; |
196 | KPimPrefs* mPrefs; | 196 | KPimPrefs* mPrefs; |
197 | QString mDefFileName; | 197 | QString mDefFileName; |
198 | QString mCurrentSyncDevice; | 198 | QString mCurrentSyncDevice; |
199 | QString mCurrentSyncName; | 199 | QString mCurrentSyncName; |
200 | void quickSyncLocalFile(); | 200 | void quickSyncLocalFile(); |
201 | bool syncWithFile( QString fn , bool quick ); | 201 | bool syncWithFile( QString fn , bool quick ); |
202 | void syncLocalFile(); | 202 | void syncLocalFile(); |
203 | void syncPhone(); | 203 | void syncPhone(); |
204 | void syncSharp(); | 204 | void syncSharp(); |
205 | void syncKDE(); | 205 | void syncKDE(); |
206 | bool syncExternalApplication(QString); | 206 | bool syncExternalApplication(QString); |
207 | int mCurrentSyncProfile ; | 207 | int mCurrentSyncProfile ; |
208 | void syncRemote( KSyncProfile* prof, bool ask = true); | 208 | void syncRemote( KSyncProfile* prof, bool ask = true); |
209 | bool edit_sync_options(); | 209 | bool edit_sync_options(); |
210 | bool edit_pisync_options(); | 210 | bool edit_pisync_options(); |
211 | int ringSync(); | 211 | int ringSync(); |
212 | QString getPassword( ); | 212 | QString getPassword( ); |
213 | bool mPisyncFinished; | 213 | bool mPisyncFinished; |
214 | QStringList mSpecificResources; | 214 | QStringList mSpecificResources; |
215 | QString mCurrentResourceLocal; | 215 | QString mCurrentResourceLocal; |
216 | QString mCurrentResourceRemote; | 216 | QString mCurrentResourceRemote; |
217 | bool mBlockSaveFlag; | 217 | bool mBlockSaveFlag; |
218 | QWidget* mParent; | 218 | QWidget* mParent; |
219 | KSyncInterface* mImplementation; | 219 | KSyncInterface* mImplementation; |
220 | TargetApp mTargetApp; | 220 | TargetApp mTargetApp; |
221 | QPopupMenu* mSyncMenu; | 221 | QPopupMenu* mSyncMenu; |
222 | QProgressBar* bar; | 222 | QProgressBar* bar; |
223 | bool mSyncWithDesktop; | 223 | bool mSyncWithDesktop; |
224 | 224 | ||
225 | private slots: | 225 | private slots: |
226 | void displayErrorPort(); | 226 | void displayErrorPort(); |
227 | void confSync(); | 227 | void confSync(); |
228 | 228 | ||
229 | 229 | ||
230 | }; | 230 | }; |
231 | 231 | ||
232 | 232 | ||
233 | class KSyncInterface | 233 | class KSyncInterface |
234 | { | 234 | { |
235 | public : | 235 | public : |
236 | virtual void removeSyncInfo( QString syncProfile) = 0; | 236 | virtual void removeSyncInfo( QString syncProfile) = 0; |
237 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; | 237 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; |
238 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 238 | virtual bool syncExternal(KSyncManager* /*manager*/, QString /*resource*/) |
239 | { | 239 | { |
240 | // empty implementation, because some syncable applications do not | 240 | // empty implementation, because some syncable applications do not |
241 | // have an external(sharpdtm) syncmode, like pwmanager. | 241 | // have an external(sharpdtm) syncmode, like pwmanager. |
242 | return false; | 242 | return false; |
243 | } | 243 | } |
244 | 244 | ||
245 | 245 | ||
246 | }; | 246 | }; |
247 | 247 | ||
248 | 248 | ||
249 | #endif | 249 | #endif |