author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkdepim | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
33 files changed, 432 insertions, 365 deletions
diff --git a/libkdepim/categoryeditdialog.cpp b/libkdepim/categoryeditdialog.cpp index e2325d2..92a1737 100644 --- a/libkdepim/categoryeditdialog.cpp +++ b/libkdepim/categoryeditdialog.cpp | |||
@@ -1,141 +1,142 @@ | |||
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 <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | #include <qlineedit.h> | 25 | #include <qlineedit.h> |
26 | #include <qlistview.h> | 26 | #include <q3listview.h> |
27 | #include <qheader.h> | 27 | #include <q3header.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <QDesktopWidget> | ||
30 | 31 | ||
31 | #include "kpimprefs.h" | 32 | #include "kpimprefs.h" |
32 | 33 | ||
33 | #include "categoryeditdialog.h" | 34 | #include "categoryeditdialog.h" |
34 | 35 | ||
35 | using namespace KPIM; | 36 | using namespace KPIM; |
36 | 37 | ||
37 | CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, | 38 | CategoryEditDialog::CategoryEditDialog( KPimPrefs *prefs, QWidget* parent, |
38 | const char* name, bool modal, | 39 | const char* name, bool modal, |
39 | WFlags fl ) | 40 | Qt::WFlags fl ) |
40 | : CategoryEditDialog_base( parent, name, modal, fl ), | 41 | : CategoryEditDialog_base( parent, name, modal, fl ), |
41 | mPrefs( prefs ) | 42 | mPrefs( prefs ) |
42 | { | 43 | { |
43 | mCategories->header()->hide(); | 44 | mCategories->header()->hide(); |
44 | 45 | ||
45 | QStringList::Iterator it; | 46 | QStringList::Iterator it; |
46 | bool categoriesExist=false; | 47 | bool categoriesExist=false; |
47 | for (it = mPrefs->mCustomCategories.begin(); | 48 | for (it = mPrefs->mCustomCategories.begin(); |
48 | it != mPrefs->mCustomCategories.end(); ++it ) { | 49 | it != mPrefs->mCustomCategories.end(); ++it ) { |
49 | new QListViewItem(mCategories,*it); | 50 | new Q3ListViewItem(mCategories,*it); |
50 | categoriesExist=true; | 51 | categoriesExist=true; |
51 | } | 52 | } |
52 | 53 | ||
53 | connect(mCategories,SIGNAL(selectionChanged(QListViewItem *)), | 54 | connect(mCategories,SIGNAL(selectionChanged(Q3ListViewItem *)), |
54 | SLOT(editItem(QListViewItem *))); | 55 | SLOT(editItem(Q3ListViewItem *))); |
55 | connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); | 56 | connect(mEdit,SIGNAL(textChanged ( const QString & )),this,SLOT(slotTextChanged(const QString &))); |
56 | mButtonRemove->setEnabled(categoriesExist); | 57 | mButtonRemove->setEnabled(categoriesExist); |
57 | mButtonModify->setEnabled(categoriesExist); | 58 | mButtonModify->setEnabled(categoriesExist); |
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 | mButtonAdd->setEnabled(!mEdit->text().isEmpty()); | 63 | mButtonAdd->setEnabled(!mEdit->text().isEmpty()); |
63 | if ( QApplication::desktop()->width() > 460 ) | 64 | if ( QApplication::desktop()->width() > 460 ) |
64 | resize( 300, 360 ); | 65 | resize( 300, 360 ); |
65 | else | 66 | else |
66 | showMaximized(); | 67 | showMaximized(); |
67 | } | 68 | } |
68 | 69 | ||
69 | /* | 70 | /* |
70 | * Destroys the object and frees any allocated resources | 71 | * Destroys the object and frees any allocated resources |
71 | */ | 72 | */ |
72 | CategoryEditDialog::~CategoryEditDialog() | 73 | CategoryEditDialog::~CategoryEditDialog() |
73 | { | 74 | { |
74 | // no need to delete child widgets, Qt does it all for us | 75 | // no need to delete child widgets, Qt does it all for us |
75 | } | 76 | } |
76 | 77 | ||
77 | void CategoryEditDialog::slotTextChanged(const QString &text) | 78 | void CategoryEditDialog::slotTextChanged(const QString &text) |
78 | { | 79 | { |
79 | mButtonAdd->setEnabled(!text.isEmpty()); | 80 | mButtonAdd->setEnabled(!text.isEmpty()); |
80 | } | 81 | } |
81 | 82 | ||
82 | void CategoryEditDialog::add() | 83 | void CategoryEditDialog::add() |
83 | { | 84 | { |
84 | if (!mEdit->text().isEmpty()) { | 85 | if (!mEdit->text().isEmpty()) { |
85 | new QListViewItem(mCategories,mEdit->text()); | 86 | new Q3ListViewItem(mCategories,mEdit->text()); |
86 | mEdit->setText(""); | 87 | mEdit->setText(""); |
87 | mButtonRemove->setEnabled(mCategories->childCount()>0); | 88 | mButtonRemove->setEnabled(mCategories->childCount()>0); |
88 | mButtonModify->setEnabled(mCategories->childCount()>0); | 89 | mButtonModify->setEnabled(mCategories->childCount()>0); |
89 | } | 90 | } |
90 | } | 91 | } |
91 | 92 | ||
92 | void CategoryEditDialog::remove() | 93 | void CategoryEditDialog::remove() |
93 | { | 94 | { |
94 | if (mCategories->currentItem()) { | 95 | if (mCategories->currentItem()) { |
95 | delete mCategories->currentItem(); | 96 | delete mCategories->currentItem(); |
96 | mButtonRemove->setEnabled(mCategories->childCount()>0); | 97 | mButtonRemove->setEnabled(mCategories->childCount()>0); |
97 | mButtonModify->setEnabled(mCategories->childCount()>0); | 98 | mButtonModify->setEnabled(mCategories->childCount()>0); |
98 | } | 99 | } |
99 | } | 100 | } |
100 | 101 | ||
101 | void CategoryEditDialog::modify() | 102 | void CategoryEditDialog::modify() |
102 | { | 103 | { |
103 | if (!mEdit->text().isEmpty()) { | 104 | if (!mEdit->text().isEmpty()) { |
104 | if (mCategories->currentItem()) { | 105 | if (mCategories->currentItem()) { |
105 | mCategories->currentItem()->setText(0,mEdit->text()); | 106 | mCategories->currentItem()->setText(0,mEdit->text()); |
106 | } | 107 | } |
107 | } | 108 | } |
108 | } | 109 | } |
109 | void CategoryEditDialog::accept() | 110 | void CategoryEditDialog::accept() |
110 | { | 111 | { |
111 | slotOk(); | 112 | slotOk(); |
112 | } | 113 | } |
113 | 114 | ||
114 | void CategoryEditDialog::slotOk() | 115 | void CategoryEditDialog::slotOk() |
115 | { | 116 | { |
116 | slotApply(); | 117 | slotApply(); |
117 | QDialog::accept(); | 118 | QDialog::accept(); |
118 | } | 119 | } |
119 | 120 | ||
120 | void CategoryEditDialog::slotApply() | 121 | void CategoryEditDialog::slotApply() |
121 | { | 122 | { |
122 | mPrefs->mCustomCategories.clear(); | 123 | mPrefs->mCustomCategories.clear(); |
123 | 124 | ||
124 | QListViewItem *item = mCategories->firstChild(); | 125 | Q3ListViewItem *item = mCategories->firstChild(); |
125 | while(item) { | 126 | while(item) { |
126 | mPrefs->mCustomCategories.append(item->text(0)); | 127 | mPrefs->mCustomCategories.append(item->text(0)); |
127 | item = item->nextSibling(); | 128 | item = item->nextSibling(); |
128 | } | 129 | } |
129 | mPrefs->writeConfig(); | 130 | mPrefs->writeConfig(); |
130 | 131 | ||
131 | emit categoryConfigChanged(); | 132 | emit categoryConfigChanged(); |
132 | } | 133 | } |
133 | 134 | ||
134 | void CategoryEditDialog::editItem(QListViewItem *item) | 135 | void CategoryEditDialog::editItem(Q3ListViewItem *item) |
135 | { | 136 | { |
136 | mEdit->setText(item->text(0)); | 137 | mEdit->setText(item->text(0)); |
137 | mButtonRemove->setEnabled(true); | 138 | mButtonRemove->setEnabled(true); |
138 | mButtonModify->setEnabled(true); | 139 | mButtonModify->setEnabled(true); |
139 | } | 140 | } |
140 | 141 | ||
141 | //US #include "categoryeditdialog.moc" | 142 | //US #include "categoryeditdialog.moc" |
diff --git a/libkdepim/categoryeditdialog.h b/libkdepim/categoryeditdialog.h index 9bb3201..828894f 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 <q3listview.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 Q3CheckListItem |
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) : QObject( parent ), | 39 | CategorySelectItem(Q3ListView * parent, const QString & text, Type tt) : QObject( parent ), |
40 | QCheckListItem (parent, text, tt ) | 40 | Q3CheckListItem (parent, text, tt ) |
41 | {;} | 41 | {;} |
42 | 42 | ||
43 | signals: | 43 | signals: |
44 | void stateChanged( QListViewItem*); | 44 | void stateChanged( Q3ListViewItem*); |
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 | Q3CheckListItem::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, Qt::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(Q3ListViewItem *item); |
79 | void slotTextChanged(const QString &text); | 79 | void slotTextChanged(const QString &text); |
80 | 80 | private: | |
81 | KPimPrefs *mPrefs; | 81 | KPimPrefs *mPrefs; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | #endif | 86 | #endif |
diff --git a/libkdepim/categoryeditdialog_base.cpp b/libkdepim/categoryeditdialog_base.cpp index 1908576..c85f6e5 100644 --- a/libkdepim/categoryeditdialog_base.cpp +++ b/libkdepim/categoryeditdialog_base.cpp | |||
@@ -1,132 +1,136 @@ | |||
1 | #include <klocale.h> | 1 | #include <klocale.h> |
2 | /**************************************************************************** | 2 | /**************************************************************************** |
3 | ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' | 3 | ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' |
4 | ** | 4 | ** |
5 | ** Created: Sat Mar 29 21:46:09 2003 | 5 | ** Created: Sat Mar 29 21:46:09 2003 |
6 | ** by: The User Interface Compiler () | 6 | ** by: The User Interface Compiler () |
7 | ** | 7 | ** |
8 | ** WARNING! All changes made in this file will be lost! | 8 | ** WARNING! All changes made in this file will be lost! |
9 | ****************************************************************************/ | 9 | ****************************************************************************/ |
10 | 10 | ||
11 | #include "categoryeditdialog_base.h" | 11 | #include "categoryeditdialog_base.h" |
12 | 12 | ||
13 | #include <qvariant.h> | 13 | #include <qvariant.h> |
14 | #include <qheader.h> | 14 | #include <q3header.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlistview.h> | 16 | #include <q3listview.h> |
17 | #include <qpushbutton.h> | 17 | #include <qpushbutton.h> |
18 | #include <qlayout.h> | 18 | #include <qlayout.h> |
19 | #include <qtooltip.h> | 19 | #include <qtooltip.h> |
20 | #include <qwhatsthis.h> | 20 | #include <q3whatsthis.h> |
21 | //Added by qt3to4: | ||
22 | #include <Q3GridLayout> | ||
23 | #include <Q3HBoxLayout> | ||
24 | #include <Q3VBoxLayout> | ||
21 | 25 | ||
22 | /* | 26 | /* |
23 | * Constructs a CategoryEditDialog_base as a child of 'parent', with the | 27 | * Constructs a CategoryEditDialog_base as a child of 'parent', with the |
24 | * name 'name' and widget flags set to 'f'. | 28 | * name 'name' and widget flags set to 'f'. |
25 | * | 29 | * |
26 | * The dialog will by default be modeless, unless you set 'modal' to | 30 | * The dialog will by default be modeless, unless you set 'modal' to |
27 | * TRUE to construct a modal dialog. | 31 | * TRUE to construct a modal dialog. |
28 | */ | 32 | */ |
29 | CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) | 33 | CategoryEditDialog_base::CategoryEditDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) |
30 | : QDialog( parent, name, true, fl ) | 34 | : QDialog( parent, name, true, fl ) |
31 | 35 | ||
32 | { | 36 | { |
33 | if ( !name ) | 37 | if ( !name ) |
34 | setName( "CategoryEditDialog_base" ); | 38 | setName( "CategoryEditDialog_base" ); |
35 | CategoryEditDialog_baseLayout = new QGridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout"); | 39 | CategoryEditDialog_baseLayout = new Q3GridLayout( this, 1, 1, 11, 6, "CategoryEditDialog_baseLayout"); |
36 | 40 | ||
37 | mEdit = new QLineEdit( this, "mEdit" ); | 41 | mEdit = new QLineEdit( this, "mEdit" ); |
38 | 42 | ||
39 | CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 0 ); | 43 | CategoryEditDialog_baseLayout->addMultiCellWidget( mEdit, 1, 1, 0, 0 ); |
40 | 44 | ||
41 | Layout13 = new QHBoxLayout( 0, 0, 6, "Layout13"); | 45 | Layout13 = new Q3HBoxLayout( 0, 0, 6, "Layout13"); |
42 | 46 | ||
43 | // mButtonHelp = new QPushButton( this, "mButtonHelp" ); | 47 | // mButtonHelp = new QPushButton( this, "mButtonHelp" ); |
44 | //mButtonHelp->setAutoDefault( TRUE ); | 48 | //mButtonHelp->setAutoDefault( TRUE ); |
45 | //Layout13->addWidget( mButtonHelp ); | 49 | //Layout13->addWidget( mButtonHelp ); |
46 | //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | 50 | //QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
47 | //Layout13->addItem( spacer ); | 51 | //Layout13->addItem( spacer ); |
48 | 52 | ||
49 | //mApply = new QPushButton( this, "mApply" ); | 53 | //mApply = new QPushButton( this, "mApply" ); |
50 | // Layout13->addWidget( mApply ); | 54 | // Layout13->addWidget( mApply ); |
51 | 55 | ||
52 | mButtonOk = new QPushButton( this, "mButtonOk" ); | 56 | mButtonOk = new QPushButton( this, "mButtonOk" ); |
53 | mButtonOk->setAutoDefault( TRUE ); | 57 | mButtonOk->setAutoDefault( TRUE ); |
54 | mButtonOk->setDefault( TRUE ); | 58 | mButtonOk->setDefault( TRUE ); |
55 | Layout13->addWidget( mButtonOk ); | 59 | Layout13->addWidget( mButtonOk ); |
56 | 60 | ||
57 | mButtonCancel = new QPushButton( this, "mButtonCancel" ); | 61 | mButtonCancel = new QPushButton( this, "mButtonCancel" ); |
58 | mButtonCancel->setAutoDefault( TRUE ); | 62 | mButtonCancel->setAutoDefault( TRUE ); |
59 | Layout13->addWidget( mButtonCancel ); | 63 | Layout13->addWidget( mButtonCancel ); |
60 | 64 | ||
61 | CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 ); | 65 | CategoryEditDialog_baseLayout->addMultiCellLayout( Layout13, 2, 2, 0, 1 ); |
62 | 66 | ||
63 | mCategories = new QListView( this, "mCategories" ); | 67 | mCategories = new Q3ListView( this, "mCategories" ); |
64 | mCategories->addColumn( tr2i18n( "Category" ) ); | 68 | mCategories->addColumn( tr2i18n( "Category" ) ); |
65 | 69 | ||
66 | CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 ); | 70 | CategoryEditDialog_baseLayout->addWidget( mCategories, 0, 0 ); |
67 | 71 | ||
68 | layout103 = new QVBoxLayout( 0, 0, 6, "layout103"); | 72 | layout103 = new Q3VBoxLayout( 0, 0, 6, "layout103"); |
69 | 73 | ||
70 | mButtonAdd = new QPushButton( this, "mButtonAdd" ); | 74 | mButtonAdd = new QPushButton( this, "mButtonAdd" ); |
71 | CategoryEditDialog_baseLayout->addMultiCellWidget(mButtonAdd , 1, 1, 1, 1 ); | 75 | CategoryEditDialog_baseLayout->addMultiCellWidget(mButtonAdd , 1, 1, 1, 1 ); |
72 | //layout103->addWidget( mButtonAdd ); | 76 | //layout103->addWidget( mButtonAdd ); |
73 | 77 | ||
74 | mButtonModify = new QPushButton( this, "mButtonModify" ); | 78 | mButtonModify = new QPushButton( this, "mButtonModify" ); |
75 | layout103->addWidget( mButtonModify ); | 79 | layout103->addWidget( mButtonModify ); |
76 | 80 | ||
77 | mButtonRemove = new QPushButton( this, "mButtonRemove" ); | 81 | mButtonRemove = new QPushButton( this, "mButtonRemove" ); |
78 | layout103->addWidget( mButtonRemove ); | 82 | layout103->addWidget( mButtonRemove ); |
79 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 83 | QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
80 | layout103->addItem( spacer_2 ); | 84 | layout103->addItem( spacer_2 ); |
81 | 85 | ||
82 | CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 ); | 86 | CategoryEditDialog_baseLayout->addLayout( layout103, 0, 1 ); |
83 | languageChange(); | 87 | languageChange(); |
84 | resize( sizeHint() ); | 88 | resize( sizeHint() ); |
85 | 89 | ||
86 | // signals and slots connections | 90 | // signals and slots connections |
87 | connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); | 91 | connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
88 | connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) ); | 92 | connect( mButtonAdd, SIGNAL( clicked() ), this, SLOT( add() ) ); |
89 | connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) ); | 93 | connect( mButtonModify, SIGNAL( clicked() ), this, SLOT( modify() ) ); |
90 | connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) ); | 94 | connect( mButtonRemove, SIGNAL( clicked() ), this, SLOT( remove() ) ); |
91 | connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); | 95 | connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); |
92 | //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); | 96 | //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); |
93 | 97 | ||
94 | // tab order | 98 | // tab order |
95 | // setTabOrder( mCategories, mEdit ); | 99 | // setTabOrder( mCategories, mEdit ); |
96 | // setTabOrder( mEdit, mButtonAdd ); | 100 | // setTabOrder( mEdit, mButtonAdd ); |
97 | // setTabOrder( mButtonAdd, mButtonModify ); | 101 | // setTabOrder( mButtonAdd, mButtonModify ); |
98 | // setTabOrder( mButtonModify, mButtonRemove ); | 102 | // setTabOrder( mButtonModify, mButtonRemove ); |
99 | // setTabOrder( mButtonRemove, mButtonHelp ); | 103 | // setTabOrder( mButtonRemove, mButtonHelp ); |
100 | // setTabOrder( mButtonHelp, mApply ); | 104 | // setTabOrder( mButtonHelp, mApply ); |
101 | // setTabOrder( mApply, mButtonOk ); | 105 | // setTabOrder( mApply, mButtonOk ); |
102 | // setTabOrder( mButtonOk, mButtonCancel ); | 106 | // setTabOrder( mButtonOk, mButtonCancel ); |
103 | } | 107 | } |
104 | 108 | ||
105 | /* | 109 | /* |
106 | * Destroys the object and frees any allocated resources | 110 | * Destroys the object and frees any allocated resources |
107 | */ | 111 | */ |
108 | CategoryEditDialog_base::~CategoryEditDialog_base() | 112 | CategoryEditDialog_base::~CategoryEditDialog_base() |
109 | { | 113 | { |
110 | // no need to delete child widgets, Qt does it all for us | 114 | // no need to delete child widgets, Qt does it all for us |
111 | } | 115 | } |
112 | 116 | ||
113 | /* | 117 | /* |
114 | * Sets the strings of the subwidgets using the current | 118 | * Sets the strings of the subwidgets using the current |
115 | * language. | 119 | * language. |
116 | */ | 120 | */ |
117 | void CategoryEditDialog_base::languageChange() | 121 | void CategoryEditDialog_base::languageChange() |
118 | { | 122 | { |
119 | setCaption( tr2i18n( "Edit Categories" ) ); | 123 | setCaption( tr2i18n( "Edit Categories" ) ); |
120 | // mButtonHelp->setText( tr2i18n( "&Help" ) ); | 124 | // mButtonHelp->setText( tr2i18n( "&Help" ) ); |
121 | // mApply->setText( tr2i18n( "&Apply" ) ); | 125 | // mApply->setText( tr2i18n( "&Apply" ) ); |
122 | mButtonOk->setText( tr2i18n( "&OK" ) ); | 126 | mButtonOk->setText( tr2i18n( "&OK" ) ); |
123 | mButtonCancel->setText( tr2i18n( "&Cancel" ) ); | 127 | mButtonCancel->setText( tr2i18n( "&Cancel" ) ); |
124 | mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); | 128 | mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); |
125 | mButtonAdd->setText( tr2i18n( "A&dd" ) ); | 129 | mButtonAdd->setText( tr2i18n( "A&dd" ) ); |
126 | mButtonModify->setText( tr2i18n( "&Modify" ) ); | 130 | mButtonModify->setText( tr2i18n( "&Modify" ) ); |
127 | mButtonRemove->setText( tr2i18n( "&Remove" ) ); | 131 | mButtonRemove->setText( tr2i18n( "&Remove" ) ); |
128 | } | 132 | } |
129 | 133 | ||
130 | void CategoryEditDialog_base::add() | 134 | void CategoryEditDialog_base::add() |
131 | { | 135 | { |
132 | qWarning( "CategoryEditDialog_base::add(): Not implemented yet" ); | 136 | qWarning( "CategoryEditDialog_base::add(): Not implemented yet" ); |
diff --git a/libkdepim/categoryeditdialog_base.h b/libkdepim/categoryeditdialog_base.h index 5557ad0..cd577b0 100644 --- a/libkdepim/categoryeditdialog_base.h +++ b/libkdepim/categoryeditdialog_base.h | |||
@@ -1,58 +1,62 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' | 2 | ** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryeditdialog_base.ui' |
3 | ** | 3 | ** |
4 | ** Created: Sat Mar 29 21:45:20 2003 | 4 | ** Created: Sat Mar 29 21:45:20 2003 |
5 | ** by: The User Interface Compiler () | 5 | ** by: The User Interface Compiler () |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | 9 | ||
10 | #ifndef CATEGORYEDITDIALOG_BASE_H | 10 | #ifndef CATEGORYEDITDIALOG_BASE_H |
11 | #define CATEGORYEDITDIALOG_BASE_H | 11 | #define CATEGORYEDITDIALOG_BASE_H |
12 | 12 | ||
13 | #include <qvariant.h> | 13 | #include <qvariant.h> |
14 | #include <qdialog.h> | 14 | #include <qdialog.h> |
15 | 15 | //Added by qt3to4: | |
16 | class QVBoxLayout; | 16 | #include <Q3VBoxLayout> |
17 | class QHBoxLayout; | 17 | #include <Q3GridLayout> |
18 | class QGridLayout; | 18 | #include <Q3HBoxLayout> |
19 | |||
20 | class Q3VBoxLayout; | ||
21 | class Q3HBoxLayout; | ||
22 | class Q3GridLayout; | ||
19 | class QLineEdit; | 23 | class QLineEdit; |
20 | class QListView; | 24 | class Q3ListView; |
21 | class QListViewItem; | 25 | class Q3ListViewItem; |
22 | class QPushButton; | 26 | class QPushButton; |
23 | 27 | ||
24 | class CategoryEditDialog_base : public QDialog | 28 | class CategoryEditDialog_base : public QDialog |
25 | { | 29 | { |
26 | Q_OBJECT | 30 | Q_OBJECT |
27 | 31 | ||
28 | public: | 32 | public: |
29 | CategoryEditDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 33 | CategoryEditDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); |
30 | ~CategoryEditDialog_base(); | 34 | ~CategoryEditDialog_base(); |
31 | 35 | ||
32 | QLineEdit* mEdit; | 36 | QLineEdit* mEdit; |
33 | QPushButton* mButtonHelp; | 37 | QPushButton* mButtonHelp; |
34 | QPushButton* mApply; | 38 | QPushButton* mApply; |
35 | QPushButton* mButtonOk; | 39 | QPushButton* mButtonOk; |
36 | QPushButton* mButtonCancel; | 40 | QPushButton* mButtonCancel; |
37 | QListView* mCategories; | 41 | Q3ListView* mCategories; |
38 | QPushButton* mButtonAdd; | 42 | QPushButton* mButtonAdd; |
39 | QPushButton* mButtonModify; | 43 | QPushButton* mButtonModify; |
40 | QPushButton* mButtonRemove; | 44 | QPushButton* mButtonRemove; |
41 | 45 | ||
42 | public slots: | 46 | public slots: |
43 | virtual void add(); | 47 | virtual void add(); |
44 | virtual void modify(); | 48 | virtual void modify(); |
45 | virtual void slotApply(); | 49 | virtual void slotApply(); |
46 | virtual void remove(); | 50 | virtual void remove(); |
47 | virtual void slotOk(); | 51 | virtual void slotOk(); |
48 | 52 | ||
49 | protected: | 53 | protected: |
50 | QGridLayout* CategoryEditDialog_baseLayout; | 54 | Q3GridLayout* CategoryEditDialog_baseLayout; |
51 | QHBoxLayout* Layout13; | 55 | Q3HBoxLayout* Layout13; |
52 | QVBoxLayout* layout103; | 56 | Q3VBoxLayout* layout103; |
53 | 57 | ||
54 | protected slots: | 58 | protected slots: |
55 | virtual void languageChange(); | 59 | virtual void languageChange(); |
56 | }; | 60 | }; |
57 | 61 | ||
58 | #endif // CATEGORYEDITDIALOG_BASE_H | 62 | #endif // CATEGORYEDITDIALOG_BASE_H |
diff --git a/libkdepim/categoryselectdialog.cpp b/libkdepim/categoryselectdialog.cpp index 2a9b43e..4f72880 100644 --- a/libkdepim/categoryselectdialog.cpp +++ b/libkdepim/categoryselectdialog.cpp | |||
@@ -1,246 +1,249 @@ | |||
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 <q3listview.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qheader.h> | 26 | #include <q3header.h> |
27 | #include <qapp.h> | 27 | #include <qapplication.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | //Added by qt3to4: | ||
30 | #include <QPixmap> | ||
31 | #include <QDesktopWidget> | ||
29 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
30 | 33 | ||
31 | 34 | ||
32 | #include "categoryeditdialog.h" | 35 | #include "categoryeditdialog.h" |
33 | #include "categoryselectdialog.h" | 36 | #include "categoryselectdialog.h" |
34 | 37 | ||
35 | #include "kpimprefs.h" | 38 | #include "kpimprefs.h" |
36 | 39 | ||
37 | using namespace KPIM; | 40 | using namespace KPIM; |
38 | 41 | ||
39 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, | 42 | CategorySelectDialog::CategorySelectDialog( KPimPrefs *prefs, QWidget* parent, |
40 | const char* name, | 43 | const char* name, |
41 | bool modal, WFlags fl ) | 44 | bool modal, Qt::WFlags fl ) |
42 | : CategorySelectDialog_base( parent, name, true, fl ), | 45 | : CategorySelectDialog_base( parent, name, true, fl ), |
43 | mPrefs( prefs ) | 46 | mPrefs( prefs ) |
44 | { | 47 | { |
45 | Q_UNUSED( modal ); | 48 | Q_UNUSED( modal ); |
46 | mColorItem = 0; | 49 | mColorItem = 0; |
47 | mColorEnabled = false; | 50 | mColorEnabled = false; |
48 | mCategories->header()->hide(); | 51 | mCategories->header()->hide(); |
49 | 52 | ||
50 | setCategories(); | 53 | setCategories(); |
51 | 54 | ||
52 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); | 55 | connect(mButtonEdit,SIGNAL(clicked()),this, SLOT(editCategoriesDialog())); |
53 | if ( QApplication::desktop()->width() > 460 ) | 56 | if ( QApplication::desktop()->width() > 460 ) |
54 | resize( 300, 360 ); | 57 | resize( 300, 360 ); |
55 | else | 58 | else |
56 | showMaximized(); | 59 | showMaximized(); |
57 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); | 60 | connect( mSetColorCat, SIGNAL( clicked() ), this, SLOT( setColorCat() ) ); |
58 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 61 | // connect( mCategories, SIGNAL( clicked(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); |
59 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
60 | mButtonOk->hide(); | 63 | mButtonOk->hide(); |
61 | mButtonCancel->hide(); | 64 | mButtonCancel->hide(); |
62 | #endif | 65 | #endif |
63 | } | 66 | } |
64 | void CategorySelectDialog::editCategoriesDialog() | 67 | void CategorySelectDialog::editCategoriesDialog() |
65 | { | 68 | { |
66 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); | 69 | KPIM::CategoryEditDialog* ced = new KPIM::CategoryEditDialog(mPrefs,this ); |
67 | 70 | ||
68 | ced->exec(); | 71 | ced->exec(); |
69 | delete ced; | 72 | delete ced; |
70 | slotApply(); | 73 | slotApply(); |
71 | QStringList temp = mCategoryList; | 74 | QStringList temp = mCategoryList; |
72 | setCategories(); | 75 | setCategories(); |
73 | setSelected( temp ); | 76 | setSelected( temp ); |
74 | } | 77 | } |
75 | void CategorySelectDialog::setCategories() | 78 | void CategorySelectDialog::setCategories() |
76 | { | 79 | { |
77 | mColorItem = 0; | 80 | mColorItem = 0; |
78 | mCategories->clear(); | 81 | mCategories->clear(); |
79 | mCategoryList.clear(); | 82 | mCategoryList.clear(); |
80 | 83 | ||
81 | QStringList::Iterator it; | 84 | QStringList::Iterator it; |
82 | for (it = mPrefs->mCustomCategories.begin(); | 85 | for (it = mPrefs->mCustomCategories.begin(); |
83 | it != mPrefs->mCustomCategories.end(); ++it ) { | 86 | it != mPrefs->mCustomCategories.end(); ++it ) { |
84 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,QCheckListItem::CheckBox); | 87 | CategorySelectItem * item = new CategorySelectItem(mCategories,*it,Q3CheckListItem::CheckBox); |
85 | QObject::connect( item, SIGNAL( stateChanged(QListViewItem *) ), this, SLOT( clicked(QListViewItem *) ) ); | 88 | QObject::connect( item, SIGNAL( stateChanged(Q3ListViewItem *) ), this, SLOT( clicked(Q3ListViewItem *) ) ); |
86 | 89 | ||
87 | } | 90 | } |
88 | } | 91 | } |
89 | 92 | ||
90 | CategorySelectDialog::~CategorySelectDialog() | 93 | CategorySelectDialog::~CategorySelectDialog() |
91 | { | 94 | { |
92 | } | 95 | } |
93 | 96 | ||
94 | void CategorySelectDialog::setSelected(const QStringList &selList) | 97 | void CategorySelectDialog::setSelected(const QStringList &selList) |
95 | { | 98 | { |
96 | clear(); | 99 | clear(); |
97 | 100 | ||
98 | QStringList::ConstIterator it; | 101 | QStringList::ConstIterator it; |
99 | QStringList notFound; | 102 | QStringList notFound; |
100 | bool found = false; | 103 | bool found = false; |
101 | for (it=selList.begin();it!=selList.end();++it) { | 104 | for (it=selList.begin();it!=selList.end();++it) { |
102 | //qDebug(" CategorySelectDialog::setSelected("); | 105 | //qDebug(" CategorySelectDialog::setSelected("); |
103 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 106 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
104 | while (item) { | 107 | while (item) { |
105 | if (item->text() == *it) { | 108 | if (item->text() == *it) { |
106 | item->setOn(true); | 109 | item->setOn(true); |
107 | if ( ! found ) | 110 | if ( ! found ) |
108 | setColorItem( item ); | 111 | setColorItem( item ); |
109 | found = true; | 112 | found = true; |
110 | break; | 113 | break; |
111 | } | 114 | } |
112 | item = (QCheckListItem *)item->nextSibling(); | 115 | item = (Q3CheckListItem *)item->nextSibling(); |
113 | } | 116 | } |
114 | // if ( ! found ) { | 117 | // if ( ! found ) { |
115 | 118 | ||
116 | //emit updateCategoriesGlobal(); | 119 | //emit updateCategoriesGlobal(); |
117 | // QMessageBox::information( this, "KO/E: Information!", | 120 | // QMessageBox::information( this, "KO/E: Information!", |
118 | // "Categories found, which were not\n" | 121 | // "Categories found, which were not\n" |
119 | // "in list of categories!\n" | 122 | // "in list of categories!\n" |
120 | // "message", | 123 | // "message", |
121 | // "OK", "", 0, | 124 | // "OK", "", 0, |
122 | // 0, 1 ); | 125 | // 0, 1 ); |
123 | // setSelected(selList); | 126 | // setSelected(selList); |
124 | // return; | 127 | // return; |
125 | // } | 128 | // } |
126 | } | 129 | } |
127 | } | 130 | } |
128 | 131 | ||
129 | QStringList CategorySelectDialog::selectedCategories() const | 132 | QStringList CategorySelectDialog::selectedCategories() const |
130 | { | 133 | { |
131 | return mCategoryList; | 134 | return mCategoryList; |
132 | } | 135 | } |
133 | void CategorySelectDialog::setColorEnabled() | 136 | void CategorySelectDialog::setColorEnabled() |
134 | { | 137 | { |
135 | mColorEnabled = true; | 138 | mColorEnabled = true; |
136 | mSetColorCat->show(); | 139 | mSetColorCat->show(); |
137 | } | 140 | } |
138 | void CategorySelectDialog::setColorCat() | 141 | void CategorySelectDialog::setColorCat() |
139 | { | 142 | { |
140 | QCheckListItem * newColorItem = (QCheckListItem * )mCategories->currentItem (); | 143 | Q3CheckListItem * newColorItem = (Q3CheckListItem * )mCategories->currentItem (); |
141 | if ( !newColorItem ) { | 144 | if ( !newColorItem ) { |
142 | KMessageBox::error(this,i18n("There is no current item.")); | 145 | KMessageBox::error(this,i18n("There is no current item.")); |
143 | return; | 146 | return; |
144 | } | 147 | } |
145 | if ( !newColorItem->isOn() ) | 148 | if ( !newColorItem->isOn() ) |
146 | newColorItem->setOn( true ); | 149 | newColorItem->setOn( true ); |
147 | setColorItem( newColorItem ); | 150 | setColorItem( newColorItem ); |
148 | 151 | ||
149 | } | 152 | } |
150 | void CategorySelectDialog::clicked ( QListViewItem * it ) | 153 | void CategorySelectDialog::clicked ( Q3ListViewItem * it ) |
151 | { | 154 | { |
152 | if ( ! it ) | 155 | if ( ! it ) |
153 | return; | 156 | return; |
154 | QCheckListItem *i = (QCheckListItem *) it; | 157 | Q3CheckListItem *i = (Q3CheckListItem *) it; |
155 | if ( !i->isOn() && i==mColorItem) { | 158 | if ( !i->isOn() && i==mColorItem) { |
156 | setColorItem( 0); | 159 | setColorItem( 0); |
157 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 160 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
158 | while (item) { | 161 | while (item) { |
159 | if (item->isOn()) { | 162 | if (item->isOn()) { |
160 | setColorItem( item ); | 163 | setColorItem( item ); |
161 | break; | 164 | break; |
162 | } | 165 | } |
163 | item = (QCheckListItem *)item->nextSibling(); | 166 | item = (Q3CheckListItem *)item->nextSibling(); |
164 | } | 167 | } |
165 | } else if ( i->isOn() && !mColorItem) { | 168 | } else if ( i->isOn() && !mColorItem) { |
166 | setColorItem( i); | 169 | setColorItem( i); |
167 | } | 170 | } |
168 | } | 171 | } |
169 | void CategorySelectDialog::setColorItem( QCheckListItem * newColorItem ) | 172 | void CategorySelectDialog::setColorItem( Q3CheckListItem * newColorItem ) |
170 | { | 173 | { |
171 | if ( !mColorEnabled ) | 174 | if ( !mColorEnabled ) |
172 | return; | 175 | return; |
173 | if ( mColorItem == newColorItem) | 176 | if ( mColorItem == newColorItem) |
174 | return; | 177 | return; |
175 | if ( mColorItem ) { | 178 | if ( mColorItem ) { |
176 | mColorItem->setPixmap ( 0, QPixmap() ); | 179 | mColorItem->setPixmap ( 0, QPixmap() ); |
177 | mColorItem = 0; | 180 | mColorItem = 0; |
178 | } | 181 | } |
179 | if ( newColorItem ) { | 182 | if ( newColorItem ) { |
180 | QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); | 183 | QPixmap pix (newColorItem->height()/2, newColorItem->height()/2 ); |
181 | pix.fill(Qt::red ); | 184 | pix.fill(Qt::red ); |
182 | newColorItem->setPixmap ( 0, pix ); | 185 | newColorItem->setPixmap ( 0, pix ); |
183 | mColorItem = newColorItem; | 186 | mColorItem = newColorItem; |
184 | } | 187 | } |
185 | } | 188 | } |
186 | void CategorySelectDialog::slotApply() | 189 | void CategorySelectDialog::slotApply() |
187 | { | 190 | { |
188 | QStringList categories; | 191 | QStringList categories; |
189 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 192 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
190 | QString colcat; | 193 | QString colcat; |
191 | while (item) { | 194 | while (item) { |
192 | if (item->isOn()) { | 195 | if (item->isOn()) { |
193 | if ( item == mColorItem) | 196 | if ( item == mColorItem) |
194 | colcat = item->text(); | 197 | colcat = item->text(); |
195 | else | 198 | else |
196 | categories.append(item->text()); | 199 | categories.append(item->text()); |
197 | } | 200 | } |
198 | item = (QCheckListItem *)item->nextSibling(); | 201 | item = (Q3CheckListItem *)item->nextSibling(); |
199 | } | 202 | } |
200 | categories.sort(); | 203 | categories.sort(); |
201 | if ( ! colcat.isEmpty() ) | 204 | if ( ! colcat.isEmpty() ) |
202 | categories.prepend( colcat ); | 205 | categories.prepend( colcat ); |
203 | // QString categoriesStr = categories.join(","); | 206 | // QString categoriesStr = categories.join(","); |
204 | 207 | ||
205 | mCategoryList = categories; | 208 | mCategoryList = categories; |
206 | 209 | ||
207 | } | 210 | } |
208 | void CategorySelectDialog::accept() | 211 | void CategorySelectDialog::accept() |
209 | { | 212 | { |
210 | slotOk(); | 213 | slotOk(); |
211 | } | 214 | } |
212 | 215 | ||
213 | void CategorySelectDialog::slotOk() | 216 | void CategorySelectDialog::slotOk() |
214 | { | 217 | { |
215 | slotApply(); | 218 | slotApply(); |
216 | emit categoriesSelected(mCategoryList); | 219 | emit categoriesSelected(mCategoryList); |
217 | emit categoriesSelected(mCategoryList.join(",")); | 220 | emit categoriesSelected(mCategoryList.join(",")); |
218 | QDialog::accept(); | 221 | QDialog::accept(); |
219 | } | 222 | } |
220 | 223 | ||
221 | void CategorySelectDialog::clear() | 224 | void CategorySelectDialog::clear() |
222 | { | 225 | { |
223 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 226 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
224 | while (item) { | 227 | while (item) { |
225 | item->setOn(false); | 228 | item->setOn(false); |
226 | item = (QCheckListItem *)item->nextSibling(); | 229 | item = (Q3CheckListItem *)item->nextSibling(); |
227 | } | 230 | } |
228 | } | 231 | } |
229 | 232 | ||
230 | void CategorySelectDialog::updateCategoryConfig() | 233 | void CategorySelectDialog::updateCategoryConfig() |
231 | { | 234 | { |
232 | QStringList selected; | 235 | QStringList selected; |
233 | QCheckListItem *item = (QCheckListItem *)mCategories->firstChild(); | 236 | Q3CheckListItem *item = (Q3CheckListItem *)mCategories->firstChild(); |
234 | while (item) { | 237 | while (item) { |
235 | if (item->isOn()) { | 238 | if (item->isOn()) { |
236 | selected.append(item->text()); | 239 | selected.append(item->text()); |
237 | } | 240 | } |
238 | item = (QCheckListItem *)item->nextSibling(); | 241 | item = (Q3CheckListItem *)item->nextSibling(); |
239 | } | 242 | } |
240 | 243 | ||
241 | setCategories(); | 244 | setCategories(); |
242 | 245 | ||
243 | setSelected(selected); | 246 | setSelected(selected); |
244 | } | 247 | } |
245 | 248 | ||
246 | //#include "categoryselectdialog.moc" | 249 | //#include "categoryselectdialog.moc" |
diff --git a/libkdepim/categoryselectdialog.h b/libkdepim/categoryselectdialog.h index 680a093..ff7ac58 100644 --- a/libkdepim/categoryselectdialog.h +++ b/libkdepim/categoryselectdialog.h | |||
@@ -1,75 +1,75 @@ | |||
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_CATEGORYSELECTDIALOG_H | 23 | #ifndef KPIM_CATEGORYSELECTDIALOG_H |
24 | #define KPIM_CATEGORYSELECTDIALOG_H | 24 | #define KPIM_CATEGORYSELECTDIALOG_H |
25 | 25 | ||
26 | #include <categoryselectdialog_base.h> | 26 | #include <categoryselectdialog_base.h> |
27 | 27 | ||
28 | class KPimPrefs; | 28 | class KPimPrefs; |
29 | class QCheckListItem; | 29 | class Q3CheckListItem; |
30 | 30 | ||
31 | namespace KPIM { | 31 | namespace KPIM { |
32 | 32 | ||
33 | class CategorySelectDialog : public CategorySelectDialog_base | 33 | class CategorySelectDialog : public CategorySelectDialog_base |
34 | { | 34 | { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | CategorySelectDialog( KPimPrefs *prefs, QWidget* parent = 0, | 37 | CategorySelectDialog( KPimPrefs *prefs, QWidget* parent = 0, |
38 | const char* name = 0, | 38 | const char* name = 0, |
39 | bool modal = FALSE, WFlags fl = 0 ); | 39 | bool modal = FALSE, Qt::WFlags fl = 0 ); |
40 | ~CategorySelectDialog(); | 40 | ~CategorySelectDialog(); |
41 | 41 | ||
42 | void setCategories(); | 42 | void setCategories(); |
43 | void setColorEnabled(); | 43 | void setColorEnabled(); |
44 | void setSelected(const QStringList &selList); | 44 | void setSelected(const QStringList &selList); |
45 | 45 | ||
46 | QStringList selectedCategories() const; | 46 | QStringList selectedCategories() const; |
47 | 47 | ||
48 | public slots: | 48 | public slots: |
49 | void slotOk(); | 49 | void slotOk(); |
50 | void slotApply(); | 50 | void slotApply(); |
51 | void clear(); | 51 | void clear(); |
52 | void accept(); | 52 | void accept(); |
53 | void editCategoriesDialog(); | 53 | void editCategoriesDialog(); |
54 | void updateCategoryConfig(); | 54 | void updateCategoryConfig(); |
55 | void setColorCat(); | 55 | void setColorCat(); |
56 | void clicked ( QListViewItem * ); | 56 | void clicked ( Q3ListViewItem * ); |
57 | signals: | 57 | signals: |
58 | void categoriesSelected(const QString &); | 58 | void categoriesSelected(const QString &); |
59 | void categoriesSelected(const QStringList &); | 59 | void categoriesSelected(const QStringList &); |
60 | void editCategories(); | 60 | void editCategories(); |
61 | 61 | ||
62 | private: | 62 | private: |
63 | bool mColorEnabled; | 63 | bool mColorEnabled; |
64 | KPimPrefs *mPrefs; | 64 | KPimPrefs *mPrefs; |
65 | QStringList mCategoryList; | 65 | QStringList mCategoryList; |
66 | QCheckListItem *mColorItem; | 66 | Q3CheckListItem *mColorItem; |
67 | void setColorItem( QCheckListItem * ); | 67 | void setColorItem( Q3CheckListItem * ); |
68 | 68 | ||
69 | class CategorySelectDialogPrivate; | 69 | class CategorySelectDialogPrivate; |
70 | CategorySelectDialogPrivate *d; | 70 | CategorySelectDialogPrivate *d; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | #endif | 75 | #endif |
diff --git a/libkdepim/categoryselectdialog_base.cpp b/libkdepim/categoryselectdialog_base.cpp index 4793fd7..5d53ac4 100644 --- a/libkdepim/categoryselectdialog_base.cpp +++ b/libkdepim/categoryselectdialog_base.cpp | |||
@@ -1,116 +1,119 @@ | |||
1 | #include <klocale.h> | 1 | #include <klocale.h> |
2 | /**************************************************************************** | 2 | /**************************************************************************** |
3 | ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' | 3 | ** Form implementation generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' |
4 | ** | 4 | ** |
5 | ** Created: Sat Mar 29 21:46:05 2003 | 5 | ** Created: Sat Mar 29 21:46:05 2003 |
6 | ** by: The User Interface Compiler () | 6 | ** by: The User Interface Compiler () |
7 | ** | 7 | ** |
8 | ** WARNING! All changes made in this file will be lost! | 8 | ** WARNING! All changes made in this file will be lost! |
9 | ****************************************************************************/ | 9 | ****************************************************************************/ |
10 | 10 | ||
11 | #include "categoryselectdialog_base.h" | 11 | #include "categoryselectdialog_base.h" |
12 | 12 | ||
13 | #include <qvariant.h> | 13 | #include <qvariant.h> |
14 | #include <qheader.h> | 14 | #include <q3header.h> |
15 | #include <qlistview.h> | 15 | #include <q3listview.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qtooltip.h> | 18 | #include <qtooltip.h> |
19 | #include <qwhatsthis.h> | 19 | #include <q3whatsthis.h> |
20 | //Added by qt3to4: | ||
21 | #include <Q3VBoxLayout> | ||
22 | #include <Q3HBoxLayout> | ||
20 | 23 | ||
21 | /* | 24 | /* |
22 | * Constructs a CategorySelectDialog_base as a child of 'parent', with the | 25 | * Constructs a CategorySelectDialog_base as a child of 'parent', with the |
23 | * name 'name' and widget flags set to 'f'. | 26 | * name 'name' and widget flags set to 'f'. |
24 | * | 27 | * |
25 | * The dialog will by default be modeless, unless you set 'modal' to | 28 | * The dialog will by default be modeless, unless you set 'modal' to |
26 | * TRUE to construct a modal dialog. | 29 | * TRUE to construct a modal dialog. |
27 | */ | 30 | */ |
28 | CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, WFlags fl ) | 31 | CategorySelectDialog_base::CategorySelectDialog_base( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) |
29 | : QDialog( parent, name, modal, fl ) | 32 | : QDialog( parent, name, modal, fl ) |
30 | 33 | ||
31 | { | 34 | { |
32 | if ( !name ) | 35 | if ( !name ) |
33 | setName( "CategorySelectDialog_base" ); | 36 | setName( "CategorySelectDialog_base" ); |
34 | CategorySelectDialog_baseLayout = new QVBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout"); | 37 | CategorySelectDialog_baseLayout = new Q3VBoxLayout( this, 11, 6, "CategorySelectDialog_baseLayout"); |
35 | 38 | ||
36 | mCategories = new QListView( this, "mCategories" ); | 39 | mCategories = new Q3ListView( this, "mCategories" ); |
37 | mCategories->addColumn( i18n( "Category" ) ); | 40 | mCategories->addColumn( i18n( "Category" ) ); |
38 | CategorySelectDialog_baseLayout->addWidget( mCategories ); | 41 | CategorySelectDialog_baseLayout->addWidget( mCategories ); |
39 | mSetColorCat = new QPushButton( this, "msetColor" ); | 42 | mSetColorCat = new QPushButton( this, "msetColor" ); |
40 | CategorySelectDialog_baseLayout->addWidget( mSetColorCat ); | 43 | CategorySelectDialog_baseLayout->addWidget( mSetColorCat ); |
41 | Layout12 = new QHBoxLayout( 0, 0, 4, "Layout12"); | 44 | Layout12 = new Q3HBoxLayout( 0, 0, 4, "Layout12"); |
42 | 45 | ||
43 | mClear = new QPushButton( this, "mClear" ); | 46 | mClear = new QPushButton( this, "mClear" ); |
44 | Layout12->addWidget( mClear ); | 47 | Layout12->addWidget( mClear ); |
45 | // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | 48 | // QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
46 | //Layout12->addItem( spacer ); | 49 | //Layout12->addItem( spacer ); |
47 | 50 | ||
48 | mButtonEdit = new QPushButton( this, "mButtonEdit" ); | 51 | mButtonEdit = new QPushButton( this, "mButtonEdit" ); |
49 | Layout12->addWidget( mButtonEdit ); | 52 | Layout12->addWidget( mButtonEdit ); |
50 | CategorySelectDialog_baseLayout->addLayout( Layout12 ); | 53 | CategorySelectDialog_baseLayout->addLayout( Layout12 ); |
51 | 54 | ||
52 | Layout11 = new QHBoxLayout( 0, 0, 4, "Layout11"); | 55 | Layout11 = new Q3HBoxLayout( 0, 0, 4, "Layout11"); |
53 | 56 | ||
54 | //mButtonHelp = new QPushButton( this, "mButtonHelp" ); | 57 | //mButtonHelp = new QPushButton( this, "mButtonHelp" ); |
55 | //Layout11->addWidget( mButtonHelp ); | 58 | //Layout11->addWidget( mButtonHelp ); |
56 | //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); | 59 | //QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); |
57 | // Layout11->addItem( spacer_2 ); | 60 | // Layout11->addItem( spacer_2 ); |
58 | 61 | ||
59 | //mApply = new QPushButton( this, "mApply" ); | 62 | //mApply = new QPushButton( this, "mApply" ); |
60 | // Layout11->addWidget( mApply ); | 63 | // Layout11->addWidget( mApply ); |
61 | 64 | ||
62 | mButtonOk = new QPushButton( this, "mButtonOk" ); | 65 | mButtonOk = new QPushButton( this, "mButtonOk" ); |
63 | mButtonOk->setOn( FALSE ); | 66 | mButtonOk->setOn( FALSE ); |
64 | mButtonOk->setDefault( TRUE ); | 67 | mButtonOk->setDefault( TRUE ); |
65 | Layout11->addWidget( mButtonOk ); | 68 | Layout11->addWidget( mButtonOk ); |
66 | 69 | ||
67 | mButtonCancel = new QPushButton( this, "mButtonCancel" ); | 70 | mButtonCancel = new QPushButton( this, "mButtonCancel" ); |
68 | Layout11->addWidget( mButtonCancel ); | 71 | Layout11->addWidget( mButtonCancel ); |
69 | CategorySelectDialog_baseLayout->addLayout( Layout11 ); | 72 | CategorySelectDialog_baseLayout->addLayout( Layout11 ); |
70 | languageChange(); | 73 | languageChange(); |
71 | // resize( sizeHint() ); | 74 | // resize( sizeHint() ); |
72 | 75 | ||
73 | // signals and slots connections | 76 | // signals and slots connections |
74 | connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); | 77 | connect( mButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); |
75 | connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); | 78 | connect( mButtonOk, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); |
76 | connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 79 | connect( mClear, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
77 | //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); | 80 | //connect( mApply, SIGNAL( clicked() ), this, SLOT( slotApply() ) ); |
78 | 81 | ||
79 | // tab order | 82 | // tab order |
80 | setTabOrder( mCategories, mClear ); | 83 | setTabOrder( mCategories, mClear ); |
81 | setTabOrder( mClear, mButtonEdit ); | 84 | setTabOrder( mClear, mButtonEdit ); |
82 | setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp ); | 85 | setTabOrder( mButtonEdit, mButtonOk );//mButtonHelp ); |
83 | // setTabOrder( mButtonHelp, mApply ); | 86 | // setTabOrder( mButtonHelp, mApply ); |
84 | // setTabOrder( mApply, mButtonOk ); | 87 | // setTabOrder( mApply, mButtonOk ); |
85 | setTabOrder( mButtonOk, mButtonCancel ); | 88 | setTabOrder( mButtonOk, mButtonCancel ); |
86 | // showMaximized(); | 89 | // showMaximized(); |
87 | //raise(); | 90 | //raise(); |
88 | mSetColorCat->hide(); | 91 | mSetColorCat->hide(); |
89 | } | 92 | } |
90 | 93 | ||
91 | /* | 94 | /* |
92 | * Destroys the object and frees any allocated resources | 95 | * Destroys the object and frees any allocated resources |
93 | */ | 96 | */ |
94 | CategorySelectDialog_base::~CategorySelectDialog_base() | 97 | CategorySelectDialog_base::~CategorySelectDialog_base() |
95 | { | 98 | { |
96 | // no need to delete child widgets, Qt does it all for us | 99 | // no need to delete child widgets, Qt does it all for us |
97 | } | 100 | } |
98 | 101 | ||
99 | /* | 102 | /* |
100 | * Sets the strings of the subwidgets using the current | 103 | * Sets the strings of the subwidgets using the current |
101 | * language. | 104 | * language. |
102 | */ | 105 | */ |
103 | void CategorySelectDialog_base::languageChange() | 106 | void CategorySelectDialog_base::languageChange() |
104 | { | 107 | { |
105 | setCaption( i18n( "Select Categories" ) ); | 108 | setCaption( i18n( "Select Categories" ) ); |
106 | mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); | 109 | mCategories->header()->setLabel( 0, tr2i18n( "Category" ) ); |
107 | mClear->setText( i18n( " &Deselect All " ) ); | 110 | mClear->setText( i18n( " &Deselect All " ) ); |
108 | mButtonEdit->setText( i18n( " &Edit Categories " ) ); | 111 | mButtonEdit->setText( i18n( " &Edit Categories " ) ); |
109 | // mButtonHelp->setText( tr2i18n( "&Help" ) ); | 112 | // mButtonHelp->setText( tr2i18n( "&Help" ) ); |
110 | //mApply->setText( i18n( "&Apply" ) ); | 113 | //mApply->setText( i18n( "&Apply" ) ); |
111 | mButtonOk->setText( i18n( "&OK" ) ); | 114 | mButtonOk->setText( i18n( "&OK" ) ); |
112 | mSetColorCat->setText( i18n( "Set current as color category" ) ); | 115 | mSetColorCat->setText( i18n( "Set current as color category" ) ); |
113 | mButtonCancel->setText( i18n( "&Cancel" ) ); | 116 | mButtonCancel->setText( i18n( "&Cancel" ) ); |
114 | } | 117 | } |
115 | 118 | ||
116 | void CategorySelectDialog_base::clear() | 119 | void CategorySelectDialog_base::clear() |
diff --git a/libkdepim/categoryselectdialog_base.h b/libkdepim/categoryselectdialog_base.h index 59ffa22..71d4ce9 100644 --- a/libkdepim/categoryselectdialog_base.h +++ b/libkdepim/categoryselectdialog_base.h | |||
@@ -1,54 +1,58 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' | 2 | ** Form interface generated from reading ui file '/build/kde/cvs/korge/kdepim/libkdepim/categoryselectdialog_base.ui' |
3 | ** | 3 | ** |
4 | ** Created: Sat Mar 29 21:45:20 2003 | 4 | ** Created: Sat Mar 29 21:45:20 2003 |
5 | ** by: The User Interface Compiler () | 5 | ** by: The User Interface Compiler () |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | 9 | ||
10 | #ifndef CATEGORYSELECTDIALOG_BASE_H | 10 | #ifndef CATEGORYSELECTDIALOG_BASE_H |
11 | #define CATEGORYSELECTDIALOG_BASE_H | 11 | #define CATEGORYSELECTDIALOG_BASE_H |
12 | 12 | ||
13 | #include <qvariant.h> | 13 | #include <qvariant.h> |
14 | #include <qdialog.h> | 14 | #include <qdialog.h> |
15 | 15 | //Added by qt3to4: | |
16 | class QVBoxLayout; | 16 | #include <Q3VBoxLayout> |
17 | class QHBoxLayout; | 17 | #include <Q3GridLayout> |
18 | class QGridLayout; | 18 | #include <Q3HBoxLayout> |
19 | class QListView; | 19 | |
20 | class QListViewItem; | 20 | class Q3VBoxLayout; |
21 | class Q3HBoxLayout; | ||
22 | class Q3GridLayout; | ||
23 | class Q3ListView; | ||
24 | class Q3ListViewItem; | ||
21 | class QPushButton; | 25 | class QPushButton; |
22 | 26 | ||
23 | class CategorySelectDialog_base : public QDialog | 27 | class CategorySelectDialog_base : public QDialog |
24 | { | 28 | { |
25 | Q_OBJECT | 29 | Q_OBJECT |
26 | 30 | ||
27 | public: | 31 | public: |
28 | CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 32 | CategorySelectDialog_base( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WFlags fl = 0 ); |
29 | ~CategorySelectDialog_base(); | 33 | ~CategorySelectDialog_base(); |
30 | 34 | ||
31 | QListView* mCategories; | 35 | Q3ListView* mCategories; |
32 | QPushButton* mClear; | 36 | QPushButton* mClear; |
33 | QPushButton* mButtonEdit; | 37 | QPushButton* mButtonEdit; |
34 | QPushButton* mButtonHelp; | 38 | QPushButton* mButtonHelp; |
35 | QPushButton* mApply; | 39 | QPushButton* mApply; |
36 | QPushButton* mButtonOk; | 40 | QPushButton* mButtonOk; |
37 | QPushButton* mButtonCancel; | 41 | QPushButton* mButtonCancel; |
38 | QPushButton* mSetColorCat; | 42 | QPushButton* mSetColorCat; |
39 | 43 | ||
40 | public slots: | 44 | public slots: |
41 | virtual void clear(); | 45 | virtual void clear(); |
42 | virtual void slotApply(); | 46 | virtual void slotApply(); |
43 | virtual void slotOk(); | 47 | virtual void slotOk(); |
44 | 48 | ||
45 | protected: | 49 | protected: |
46 | QVBoxLayout* CategorySelectDialog_baseLayout; | 50 | Q3VBoxLayout* CategorySelectDialog_baseLayout; |
47 | QHBoxLayout* Layout12; | 51 | Q3HBoxLayout* Layout12; |
48 | QHBoxLayout* Layout11; | 52 | Q3HBoxLayout* Layout11; |
49 | 53 | ||
50 | protected slots: | 54 | protected slots: |
51 | virtual void languageChange(); | 55 | virtual void languageChange(); |
52 | }; | 56 | }; |
53 | 57 | ||
54 | #endif // CATEGORYSELECTDIALOG_BASE_H | 58 | #endif // CATEGORYSELECTDIALOG_BASE_H |
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index f376e6c..3fc548a 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,381 +1,383 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qtimer.h> | 33 | #include <qtimer.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | 36 | ||
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qtopia/qcopenvelope_qws.h> | 39 | #include <qtopia/qcopenvelope_qws.h> |
40 | #else | 40 | #else |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qprocess.h> | 42 | #include <q3process.h> |
43 | //Added by qt3to4: | ||
44 | #include <Q3CString> | ||
43 | #endif | 45 | #endif |
44 | 46 | ||
45 | #include <kstaticdeleter.h> | 47 | #include <kstaticdeleter.h> |
46 | #include <kmessagebox.h> | 48 | #include <kmessagebox.h> |
47 | 49 | ||
48 | 50 | ||
49 | #include "externalapphandler.h" | 51 | #include "externalapphandler.h" |
50 | 52 | ||
51 | #include "kpimglobalprefs.h" | 53 | #include "kpimglobalprefs.h" |
52 | 54 | ||
53 | //uncomment line to get debug output | 55 | //uncomment line to get debug output |
54 | //#define DEBUG_EXT_APP_HANDLER | 56 | //#define DEBUG_EXT_APP_HANDLER |
55 | 57 | ||
56 | /********************************************************************************* | 58 | /********************************************************************************* |
57 | * | 59 | * |
58 | ********************************************************************************/ | 60 | ********************************************************************************/ |
59 | 61 | ||
60 | 62 | ||
61 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 63 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
62 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 64 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
63 | { | 65 | { |
64 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 66 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
65 | if (_usedSourceParameters == 0) | 67 | if (_usedSourceParameters == 0) |
66 | _sourceMessageParameters = "QString,QString)"; | 68 | _sourceMessageParameters = "QString,QString)"; |
67 | else if (_usedSourceParameters == 1) | 69 | else if (_usedSourceParameters == 1) |
68 | _sourceMessageParameters = "(QString,QString,QString)"; | 70 | _sourceMessageParameters = "(QString,QString,QString)"; |
69 | else if (_usedSourceParameters == 2) | 71 | else if (_usedSourceParameters == 2) |
70 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 72 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
71 | else if (_usedSourceParameters == 3) | 73 | else if (_usedSourceParameters == 3) |
72 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 74 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
73 | } | 75 | } |
74 | 76 | ||
75 | /*********************************************************************************/ | 77 | /*********************************************************************************/ |
76 | 78 | ||
77 | QCopTransferItem::QCopTransferItem() | 79 | QCopTransferItem::QCopTransferItem() |
78 | { | 80 | { |
79 | } | 81 | } |
80 | 82 | ||
81 | /*********************************************************************************/ | 83 | /*********************************************************************************/ |
82 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 84 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
83 | { | 85 | { |
84 | 86 | ||
85 | #ifndef DESKTOP_VERSION | 87 | #ifndef DESKTOP_VERSION |
86 | //sourceMessage passes two parameters: sourceChannel, uid | 88 | //sourceMessage passes two parameters: sourceChannel, uid |
87 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 89 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
88 | #ifdef DEBUG_EXT_APP_HANDLER | 90 | #ifdef DEBUG_EXT_APP_HANDLER |
89 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 91 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
90 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 92 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
91 | #endif | 93 | #endif |
92 | 94 | ||
93 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 95 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
94 | 96 | ||
95 | e << _sourceChannel << uid; | 97 | e << _sourceChannel << uid; |
96 | 98 | ||
97 | if (_usedSourceParameters == 1) | 99 | if (_usedSourceParameters == 1) |
98 | e << param1; | 100 | e << param1; |
99 | else if (_usedSourceParameters == 2) | 101 | else if (_usedSourceParameters == 2) |
100 | e << param1 << param2; | 102 | e << param1 << param2; |
101 | else if (_usedSourceParameters == 3) | 103 | else if (_usedSourceParameters == 3) |
102 | e << param1 << param2 << param3; | 104 | e << param1 << param2 << param3; |
103 | 105 | ||
104 | qApp->processEvents(); | 106 | qApp->processEvents(); |
105 | 107 | ||
106 | return true; | 108 | return true; |
107 | 109 | ||
108 | #else | 110 | #else |
109 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 111 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
110 | return false; | 112 | return false; |
111 | #endif | 113 | #endif |
112 | 114 | ||
113 | } | 115 | } |
114 | 116 | ||
115 | 117 | ||
116 | /*********************************************************************************/ | 118 | /*********************************************************************************/ |
117 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 119 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
118 | { | 120 | { |
119 | 121 | ||
120 | if ( !sourceChannel.isEmpty()) | 122 | if ( !sourceChannel.isEmpty()) |
121 | _sourceChannel = sourceChannel; | 123 | _sourceChannel = sourceChannel; |
122 | } | 124 | } |
123 | 125 | ||
124 | 126 | ||
125 | /*********************************************************************************/ | 127 | /*********************************************************************************/ |
126 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 128 | bool QCopTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
127 | { | 129 | { |
128 | 130 | ||
129 | // copied from old mail2 | 131 | // copied from old mail2 |
130 | /* | 132 | /* |
131 | static int ii = 0; | 133 | static int ii = 0; |
132 | 134 | ||
133 | // block second call | 135 | // block second call |
134 | if ( ii < 2 ) { | 136 | if ( ii < 2 ) { |
135 | ++ii; | 137 | ++ii; |
136 | if ( ii > 1 ) { | 138 | if ( ii > 1 ) { |
137 | qDebug("qcop call blocked "); | 139 | qDebug("qcop call blocked "); |
138 | return true; | 140 | return true; |
139 | } | 141 | } |
140 | } | 142 | } |
141 | */ | 143 | */ |
142 | 144 | ||
143 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 145 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
144 | 146 | ||
145 | //we are in the target and get a request from the source | 147 | //we are in the target and get a request from the source |
146 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 148 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
147 | { | 149 | { |
148 | 150 | ||
149 | QDataStream stream( data, IO_ReadOnly ); | 151 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
150 | 152 | ||
151 | 153 | ||
152 | QString sourceChannel; | 154 | QString sourceChannel; |
153 | QString uid; | 155 | QString uid; |
154 | QString param1; | 156 | QString param1; |
155 | QString param2; | 157 | QString param2; |
156 | QString param3; | 158 | QString param3; |
157 | 159 | ||
158 | stream >> sourceChannel >> uid; | 160 | stream >> sourceChannel >> uid; |
159 | 161 | ||
160 | if (_usedSourceParameters == 0) | 162 | if (_usedSourceParameters == 0) |
161 | { | 163 | { |
162 | emit receivedMessageFromSource(sourceChannel, uid); | 164 | emit receivedMessageFromSource(sourceChannel, uid); |
163 | } | 165 | } |
164 | else if (_usedSourceParameters == 1) | 166 | else if (_usedSourceParameters == 1) |
165 | { | 167 | { |
166 | stream >> param1; | 168 | stream >> param1; |
167 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 169 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
168 | } | 170 | } |
169 | else if (_usedSourceParameters == 2) | 171 | else if (_usedSourceParameters == 2) |
170 | { | 172 | { |
171 | stream >> param1 >> param2; | 173 | stream >> param1 >> param2; |
172 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 174 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
173 | } | 175 | } |
174 | else if (_usedSourceParameters == 3) | 176 | else if (_usedSourceParameters == 3) |
175 | { | 177 | { |
176 | stream >> param1 >> param2 >> param3; | 178 | stream >> param1 >> param2 >> param3; |
177 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | 179 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); |
178 | } | 180 | } |
179 | 181 | ||
180 | return true; | 182 | return true; |
181 | } | 183 | } |
182 | 184 | ||
183 | return false; | 185 | return false; |
184 | } | 186 | } |
185 | 187 | ||
186 | 188 | ||
187 | /********************************************************************************* | 189 | /********************************************************************************* |
188 | * | 190 | * |
189 | ********************************************************************************/ | 191 | ********************************************************************************/ |
190 | 192 | ||
191 | 193 | ||
192 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 194 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
193 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 195 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
194 | { | 196 | { |
195 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 197 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
196 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 198 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
197 | } | 199 | } |
198 | 200 | ||
199 | /*********************************************************************************/ | 201 | /*********************************************************************************/ |
200 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 202 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
201 | { | 203 | { |
202 | #ifndef DESKTOP_VERSION | 204 | #ifndef DESKTOP_VERSION |
203 | //targetMessage passes two parameters: uid, map | 205 | //targetMessage passes two parameters: uid, map |
204 | QString targetMessage = _targetMessage + _targetMessageParameters; | 206 | QString targetMessage = _targetMessage + _targetMessageParameters; |
205 | 207 | ||
206 | #ifdef DEBUG_EXT_APP_HANDLER | 208 | #ifdef DEBUG_EXT_APP_HANDLER |
207 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 209 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
208 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 210 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
209 | #endif | 211 | #endif |
210 | 212 | ||
211 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 213 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
212 | //US we need no names in the To field. The emailadresses are enough | 214 | //US we need no names in the To field. The emailadresses are enough |
213 | 215 | ||
214 | e << uid << nameEmailMap; | 216 | e << uid << nameEmailMap; |
215 | 217 | ||
216 | qApp->processEvents(); | 218 | qApp->processEvents(); |
217 | 219 | ||
218 | return true; | 220 | return true; |
219 | 221 | ||
220 | #else | 222 | #else |
221 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 223 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
222 | return false; | 224 | return false; |
223 | #endif | 225 | #endif |
224 | 226 | ||
225 | } | 227 | } |
226 | 228 | ||
227 | 229 | ||
228 | /*********************************************************************************/ | 230 | /*********************************************************************************/ |
229 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 231 | bool QCopMapTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
230 | { | 232 | { |
231 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 233 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
232 | 234 | ||
233 | if (res == false) | 235 | if (res == false) |
234 | { | 236 | { |
235 | QDataStream stream( data, IO_ReadOnly ); | 237 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
236 | 238 | ||
237 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 239 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
238 | 240 | ||
239 | //we are in the source and get an answer from the target | 241 | //we are in the source and get an answer from the target |
240 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 242 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
241 | { | 243 | { |
242 | QMap<QString,QString> adrMap; | 244 | QMap<QString,QString> adrMap; |
243 | QString uid; | 245 | QString uid; |
244 | 246 | ||
245 | stream >> uid >> adrMap; | 247 | stream >> uid >> adrMap; |
246 | 248 | ||
247 | emit receivedMessageFromTarget(uid, adrMap); | 249 | emit receivedMessageFromTarget(uid, adrMap); |
248 | 250 | ||
249 | 251 | ||
250 | return true; | 252 | return true; |
251 | } | 253 | } |
252 | } | 254 | } |
253 | 255 | ||
254 | return false; | 256 | return false; |
255 | } | 257 | } |
256 | 258 | ||
257 | 259 | ||
258 | /********************************************************************************* | 260 | /********************************************************************************* |
259 | * | 261 | * |
260 | ********************************************************************************/ | 262 | ********************************************************************************/ |
261 | 263 | ||
262 | QCopListTransferItem::~QCopListTransferItem() | 264 | QCopListTransferItem::~QCopListTransferItem() |
263 | { | 265 | { |
264 | 266 | ||
265 | } | 267 | } |
266 | 268 | ||
267 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 269 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
268 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 270 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
269 | { | 271 | { |
270 | //targetMessage returns later two parameters: uid, and three lists | 272 | //targetMessage returns later two parameters: uid, and three lists |
271 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; | 273 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; |
272 | } | 274 | } |
273 | 275 | ||
274 | /*********************************************************************************/ | 276 | /*********************************************************************************/ |
275 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 277 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
276 | { | 278 | { |
277 | #ifndef DESKTOP_VERSION | 279 | #ifndef DESKTOP_VERSION |
278 | //targetMessage passes two parameters: uid, map | 280 | //targetMessage passes two parameters: uid, map |
279 | QString targetMessage = _targetMessage + _targetMessageParameters; | 281 | QString targetMessage = _targetMessage + _targetMessageParameters; |
280 | 282 | ||
281 | #ifdef DEBUG_EXT_APP_HANDLER | 283 | #ifdef DEBUG_EXT_APP_HANDLER |
282 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 284 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
283 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); | 285 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); |
284 | 286 | ||
285 | 287 | ||
286 | for ( int i = 0; i < list3.count(); i++) | 288 | for ( int i = 0; i < list3.count(); i++) |
287 | qDebug("listentry list3: %s",list3[i].latin1()); | 289 | qDebug("listentry list3: %s",list3[i].latin1()); |
288 | #endif | 290 | #endif |
289 | 291 | ||
290 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 292 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
291 | //US we need no names in the To field. The emailadresses are enough | 293 | //US we need no names in the To field. The emailadresses are enough |
292 | 294 | ||
293 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; | 295 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; |
294 | 296 | ||
295 | qApp->processEvents(); | 297 | qApp->processEvents(); |
296 | 298 | ||
297 | return true; | 299 | return true; |
298 | 300 | ||
299 | #else | 301 | #else |
300 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 302 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
301 | return false; | 303 | return false; |
302 | #endif | 304 | #endif |
303 | 305 | ||
304 | } | 306 | } |
305 | 307 | ||
306 | 308 | ||
307 | /*********************************************************************************/ | 309 | /*********************************************************************************/ |
308 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 310 | bool QCopListTransferItem::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
309 | { | 311 | { |
310 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 312 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
311 | #ifdef DEBUG_EXT_APP_HANDLER | 313 | #ifdef DEBUG_EXT_APP_HANDLER |
312 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 314 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
313 | #endif | 315 | #endif |
314 | 316 | ||
315 | if (res == false) | 317 | if (res == false) |
316 | { | 318 | { |
317 | QDataStream stream( data, IO_ReadOnly ); | 319 | QDataStream stream( const_cast<QByteArray*>(&data), QIODevice::ReadOnly ); |
318 | 320 | ||
319 | #ifdef DEBUG_EXT_APP_HANDLER | 321 | #ifdef DEBUG_EXT_APP_HANDLER |
320 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 322 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
321 | #endif | 323 | #endif |
322 | 324 | ||
323 | //we are in the source and get an answer from the target | 325 | //we are in the source and get an answer from the target |
324 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 326 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
325 | { | 327 | { |
326 | QStringList list1; | 328 | QStringList list1; |
327 | QStringList list2; | 329 | QStringList list2; |
328 | QStringList list3; | 330 | QStringList list3; |
329 | QStringList list4; | 331 | QStringList list4; |
330 | QStringList list5; | 332 | QStringList list5; |
331 | QStringList list6; | 333 | QStringList list6; |
332 | QString uid; | 334 | QString uid; |
333 | 335 | ||
334 | #ifdef DEBUG_EXT_APP_HANDLER | 336 | #ifdef DEBUG_EXT_APP_HANDLER |
335 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 337 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
336 | #endif | 338 | #endif |
337 | 339 | ||
338 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; | 340 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; |
339 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); | 341 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); |
340 | 342 | ||
341 | 343 | ||
342 | return true; | 344 | return true; |
343 | } | 345 | } |
344 | } | 346 | } |
345 | 347 | ||
346 | return false; | 348 | return false; |
347 | } | 349 | } |
348 | 350 | ||
349 | 351 | ||
350 | 352 | ||
351 | /********************************************************************************* | 353 | /********************************************************************************* |
352 | * | 354 | * |
353 | ********************************************************************************/ | 355 | ********************************************************************************/ |
354 | 356 | ||
355 | 357 | ||
356 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 358 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
357 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 359 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
358 | 360 | ||
359 | ExternalAppHandler::ExternalAppHandler() | 361 | ExternalAppHandler::ExternalAppHandler() |
360 | { | 362 | { |
361 | mDefaultItems.setAutoDelete(true); | 363 | mDefaultItems.setAutoDelete(true); |
362 | 364 | ||
363 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 365 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
364 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 366 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
365 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 367 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
366 | 368 | ||
367 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 369 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
368 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 370 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
369 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 371 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
370 | 372 | ||
371 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 373 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
372 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 374 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
373 | 375 | ||
374 | 376 | ||
375 | 377 | ||
376 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); | 378 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); |
377 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); | 379 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); |
378 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 380 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
379 | 381 | ||
380 | 382 | ||
381 | } | 383 | } |
@@ -457,131 +459,131 @@ void ExternalAppHandler::loadConfig() | |||
457 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 459 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
458 | ( QFile::exists( opiepath + "/bin/ompi" )) || | 460 | ( QFile::exists( opiepath + "/bin/ompi" )) || |
459 | ( QFile::exists( qtpath + "/bin/ompi" ))) | 461 | ( QFile::exists( qtpath + "/bin/ompi" ))) |
460 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 462 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
461 | 463 | ||
462 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || | 464 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || |
463 | ( QFile::exists( qtpath + "/bin/qtmail" ))) | 465 | ( QFile::exists( qtpath + "/bin/qtmail" ))) |
464 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 466 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
465 | 467 | ||
466 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 468 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
467 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 469 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
468 | 470 | ||
469 | if ( QFile::exists( opiepath + "/bin/mailit" )) | 471 | if ( QFile::exists( opiepath + "/bin/mailit" )) |
470 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 472 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
471 | #endif | 473 | #endif |
472 | 474 | ||
473 | 475 | ||
474 | //phoneclients | 476 | //phoneclients |
475 | 477 | ||
476 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 478 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
477 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 479 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
478 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 480 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
479 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 481 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
480 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 482 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
481 | 483 | ||
482 | //faxclients | 484 | //faxclients |
483 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 485 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
484 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 486 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
485 | 487 | ||
486 | //smsclients | 488 | //smsclients |
487 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 489 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
488 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 490 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
489 | 491 | ||
490 | //pagerclients | 492 | //pagerclients |
491 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 493 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
492 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 494 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
493 | 495 | ||
494 | //sipclients | 496 | //sipclients |
495 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); | 497 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); |
496 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); | 498 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); |
497 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 499 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
498 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 500 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
499 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 501 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
500 | 502 | ||
501 | } | 503 | } |
502 | 504 | ||
503 | ExternalAppHandler *ExternalAppHandler::instance() | 505 | ExternalAppHandler *ExternalAppHandler::instance() |
504 | { | 506 | { |
505 | if ( !sInstance ) { | 507 | if ( !sInstance ) { |
506 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 508 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
507 | sInstance->loadConfig(); | 509 | sInstance->loadConfig(); |
508 | } | 510 | } |
509 | 511 | ||
510 | return sInstance; | 512 | return sInstance; |
511 | } | 513 | } |
512 | 514 | ||
513 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 515 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
514 | { | 516 | { |
515 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 517 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
516 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 518 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
517 | mDefaultItems.append(dai); | 519 | mDefaultItems.append(dai); |
518 | } | 520 | } |
519 | 521 | ||
520 | 522 | ||
521 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 523 | Q3PtrList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
522 | { | 524 | { |
523 | QList<DefaultAppItem> list; | 525 | Q3PtrList<DefaultAppItem> list; |
524 | 526 | ||
525 | DefaultAppItem* dai; | 527 | DefaultAppItem* dai; |
526 | 528 | ||
527 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 529 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
528 | { | 530 | { |
529 | if (dai->_type == type) | 531 | if (dai->_type == type) |
530 | list.append(dai); | 532 | list.append(dai); |
531 | } | 533 | } |
532 | 534 | ||
533 | return list; | 535 | return list; |
534 | } | 536 | } |
535 | 537 | ||
536 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 538 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
537 | { | 539 | { |
538 | DefaultAppItem* dai; | 540 | DefaultAppItem* dai; |
539 | 541 | ||
540 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 542 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
541 | { | 543 | { |
542 | if (dai->_type == type && dai->_id == clientid) | 544 | if (dai->_type == type && dai->_id == clientid) |
543 | return dai; | 545 | return dai; |
544 | } | 546 | } |
545 | 547 | ||
546 | return 0; | 548 | return 0; |
547 | } | 549 | } |
548 | 550 | ||
549 | bool ExternalAppHandler::isEmailAppAvailable() | 551 | bool ExternalAppHandler::isEmailAppAvailable() |
550 | { | 552 | { |
551 | 553 | ||
552 | if (mEmailAppAvailable == UNDEFINED) | 554 | if (mEmailAppAvailable == UNDEFINED) |
553 | { | 555 | { |
554 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 556 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
555 | if (client == KPimGlobalPrefs::NONE_EMC) | 557 | if (client == KPimGlobalPrefs::NONE_EMC) |
556 | mEmailAppAvailable = UNAVAILABLE; | 558 | mEmailAppAvailable = UNAVAILABLE; |
557 | else | 559 | else |
558 | mEmailAppAvailable = AVAILABLE; | 560 | mEmailAppAvailable = AVAILABLE; |
559 | } | 561 | } |
560 | return (mEmailAppAvailable == AVAILABLE); | 562 | return (mEmailAppAvailable == AVAILABLE); |
561 | 563 | ||
562 | } | 564 | } |
563 | 565 | ||
564 | bool ExternalAppHandler::isSMSAppAvailable() | 566 | bool ExternalAppHandler::isSMSAppAvailable() |
565 | { | 567 | { |
566 | #ifndef DESKTOP_VERSION | 568 | #ifndef DESKTOP_VERSION |
567 | if (mSMSAppAvailable == UNDEFINED) | 569 | if (mSMSAppAvailable == UNDEFINED) |
568 | { | 570 | { |
569 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 571 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
570 | if (client == KPimGlobalPrefs::NONE_SMC) | 572 | if (client == KPimGlobalPrefs::NONE_SMC) |
571 | mSMSAppAvailable = UNAVAILABLE; | 573 | mSMSAppAvailable = UNAVAILABLE; |
572 | else | 574 | else |
573 | mSMSAppAvailable = AVAILABLE; | 575 | mSMSAppAvailable = AVAILABLE; |
574 | } | 576 | } |
575 | 577 | ||
576 | return (mSMSAppAvailable == AVAILABLE); | 578 | return (mSMSAppAvailable == AVAILABLE); |
577 | #else //DESKTOP_VERSION | 579 | #else //DESKTOP_VERSION |
578 | return false; | 580 | return false; |
579 | #endif //DESKTOP_VERSION | 581 | #endif //DESKTOP_VERSION |
580 | } | 582 | } |
581 | 583 | ||
582 | bool ExternalAppHandler::isPhoneAppAvailable() | 584 | bool ExternalAppHandler::isPhoneAppAvailable() |
583 | { | 585 | { |
584 | #ifndef DESKTOP_VERSION | 586 | #ifndef DESKTOP_VERSION |
585 | if (mPhoneAppAvailable == UNDEFINED) | 587 | if (mPhoneAppAvailable == UNDEFINED) |
586 | { | 588 | { |
587 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 589 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
@@ -685,233 +687,233 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
685 | channel = dai->_channel; | 687 | channel = dai->_channel; |
686 | message2 = dai->_message2; | 688 | message2 = dai->_message2; |
687 | parameters2 = dai->_parameters2; | 689 | parameters2 = dai->_parameters2; |
688 | } | 690 | } |
689 | 691 | ||
690 | //first check if one of the mailers need the emails right in the message. | 692 | //first check if one of the mailers need the emails right in the message. |
691 | message2 = translateMessage(message2, emails, urls); | 693 | message2 = translateMessage(message2, emails, urls); |
692 | 694 | ||
693 | 695 | ||
694 | #ifdef DEBUG_EXT_APP_HANDLER | 696 | #ifdef DEBUG_EXT_APP_HANDLER |
695 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 697 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
696 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 698 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
697 | #endif | 699 | #endif |
698 | 700 | ||
699 | 701 | ||
700 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 702 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
701 | //US we need no names in the To field. The emailadresses are enough | 703 | //US we need no names in the To field. The emailadresses are enough |
702 | 704 | ||
703 | passParameters(&e, parameters2, emails, urls); | 705 | passParameters(&e, parameters2, emails, urls); |
704 | 706 | ||
705 | 707 | ||
706 | 708 | ||
707 | #else | 709 | #else |
708 | //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); | 710 | //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); |
709 | 711 | ||
710 | QString channel; | 712 | QString channel; |
711 | QString message2; | 713 | QString message2; |
712 | QString parameters2; | 714 | QString parameters2; |
713 | QString message; | 715 | QString message; |
714 | QString parameters; | 716 | QString parameters; |
715 | 717 | ||
716 | 718 | ||
717 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 719 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
718 | if (client == KPimGlobalPrefs::OTHER_EMC) | 720 | if (client == KPimGlobalPrefs::OTHER_EMC) |
719 | { | 721 | { |
720 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 722 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
721 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 723 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
722 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage2; | 724 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage2; |
723 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 725 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
724 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters2; | 726 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters2; |
725 | } | 727 | } |
726 | else | 728 | else |
727 | { | 729 | { |
728 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 730 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
729 | if (!dai) | 731 | if (!dai) |
730 | { | 732 | { |
731 | qDebug("could not find configured email application."); | 733 | qDebug("could not find configured email application."); |
732 | return false; | 734 | return false; |
733 | } | 735 | } |
734 | channel = dai->_channel; | 736 | channel = dai->_channel; |
735 | message2 = dai->_message2; | 737 | message2 = dai->_message2; |
736 | parameters2 = dai->_parameters2; | 738 | parameters2 = dai->_parameters2; |
737 | message = dai->_message; | 739 | message = dai->_message; |
738 | parameters = dai->_parameters; | 740 | parameters = dai->_parameters; |
739 | } | 741 | } |
740 | 742 | ||
741 | //first check if one of the mailers need the emails right in the message. | 743 | //first check if one of the mailers need the emails right in the message. |
742 | message2 = translateMessage(message2, emails, urls); | 744 | message2 = translateMessage(message2, emails, urls); |
743 | #ifdef DEBUG_EXT_APP_HANDLER | 745 | #ifdef DEBUG_EXT_APP_HANDLER |
744 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 746 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
745 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 747 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
746 | #endif | 748 | #endif |
747 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); | 749 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); |
748 | //KMessageBox::sorry( 0, message2 ); | 750 | //KMessageBox::sorry( 0, message2 ); |
749 | QProcess * proc = new QProcess( this ); | 751 | Q3Process * proc = new Q3Process( this ); |
750 | int i = 0; | 752 | int i = 0; |
751 | proc->addArgument( channel ); | 753 | proc->addArgument( channel ); |
752 | 754 | ||
753 | if ( message.find (" " ) > 0 ) { | 755 | if ( message.find (" " ) > 0 ) { |
754 | QStringList list = QStringList::split( " ", message ); | 756 | QStringList list = QStringList::split( " ", message ); |
755 | int i = 0; | 757 | int i = 0; |
756 | while ( i < list.count ( ) ) { | 758 | while ( i < list.count ( ) ) { |
757 | //qDebug("add%sdd ",list[i].latin1() ); | 759 | //qDebug("add%sdd ",list[i].latin1() ); |
758 | proc->addArgument( list[i] ); | 760 | proc->addArgument( list[i] ); |
759 | //KMessageBox::sorry( 0,list[i]); | 761 | //KMessageBox::sorry( 0,list[i]); |
760 | ++i; | 762 | ++i; |
761 | } | 763 | } |
762 | } else { | 764 | } else { |
763 | proc->addArgument(message ); | 765 | proc->addArgument(message ); |
764 | //KMessageBox::sorry( 0, message ); | 766 | //KMessageBox::sorry( 0, message ); |
765 | 767 | ||
766 | } | 768 | } |
767 | 769 | ||
768 | parameters2 = translateMessage(parameters2, urls, "" ); | 770 | parameters2 = translateMessage(parameters2, urls, "" ); |
769 | QString arg = "to='%1'"; | 771 | QString arg = "to='%1'"; |
770 | arg = arg.arg( emails ) + ","+parameters2;; | 772 | arg = arg.arg( emails ) + ","+parameters2;; |
771 | 773 | ||
772 | //KMessageBox::sorry( 0,arg ); | 774 | //KMessageBox::sorry( 0,arg ); |
773 | //qDebug("2add%sdd ",arg.latin1() ); | 775 | //qDebug("2add%sdd ",arg.latin1() ); |
774 | proc->addArgument( arg); | 776 | proc->addArgument( arg); |
775 | proc->launch(""); | 777 | proc->launch(QString()); |
776 | #endif | 778 | #endif |
777 | 779 | ||
778 | return true; | 780 | return true; |
779 | } | 781 | } |
780 | 782 | ||
781 | /************************************************************************** | 783 | /************************************************************************** |
782 | * | 784 | * |
783 | **************************************************************************/ | 785 | **************************************************************************/ |
784 | 786 | ||
785 | 787 | ||
786 | //calls the emailapplication and creates a mail with parameter emails as recipients | 788 | //calls the emailapplication and creates a mail with parameter emails as recipients |
787 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 789 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
788 | { | 790 | { |
789 | 791 | ||
790 | QString channel; | 792 | QString channel; |
791 | QString message; | 793 | QString message; |
792 | QString parameters; | 794 | QString parameters; |
793 | 795 | ||
794 | 796 | ||
795 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 797 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
796 | if (client == KPimGlobalPrefs::OTHER_EMC) | 798 | if (client == KPimGlobalPrefs::OTHER_EMC) |
797 | { | 799 | { |
798 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 800 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
799 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 801 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
800 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 802 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
801 | } | 803 | } |
802 | else | 804 | else |
803 | { | 805 | { |
804 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 806 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
805 | if (!dai) | 807 | if (!dai) |
806 | { | 808 | { |
807 | qDebug("could not find configured email application."); | 809 | qDebug("could not find configured email application."); |
808 | return false; | 810 | return false; |
809 | } | 811 | } |
810 | channel = dai->_channel; | 812 | channel = dai->_channel; |
811 | message = dai->_message; | 813 | message = dai->_message; |
812 | parameters = dai->_parameters; | 814 | parameters = dai->_parameters; |
813 | } | 815 | } |
814 | 816 | ||
815 | #ifdef DESKTOP_VERSION | 817 | #ifdef DESKTOP_VERSION |
816 | //message = channel + " " +message + " \""+ parameters + "\""; | 818 | //message = channel + " " +message + " \""+ parameters + "\""; |
817 | #endif | 819 | #endif |
818 | //first check if one of the mailers need the emails right in the message. | 820 | //first check if one of the mailers need the emails right in the message. |
819 | message = translateMessage(message, name, emailadress); | 821 | message = translateMessage(message, name, emailadress); |
820 | 822 | ||
821 | #ifdef DEBUG_EXT_APP_HANDLER | 823 | #ifdef DEBUG_EXT_APP_HANDLER |
822 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 824 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
823 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 825 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
824 | #endif | 826 | #endif |
825 | 827 | ||
826 | #ifndef DESKTOP_VERSION | 828 | #ifndef DESKTOP_VERSION |
827 | QCopEnvelope e(channel.latin1(), message.latin1()); | 829 | QCopEnvelope e(channel.latin1(), message.latin1()); |
828 | //US we need no names in the To field. The emailadresses are enough | 830 | //US we need no names in the To field. The emailadresses are enough |
829 | 831 | ||
830 | passParameters(&e, parameters, name, emailadress); | 832 | passParameters(&e, parameters, name, emailadress); |
831 | #else // DESKTOP_VERSION | 833 | #else // DESKTOP_VERSION |
832 | 834 | ||
833 | //KMessageBox::sorry( 0,channel ); | 835 | //KMessageBox::sorry( 0,channel ); |
834 | QProcess * proc = new QProcess( this ); | 836 | Q3Process * proc = new Q3Process( this ); |
835 | proc->addArgument( channel ); | 837 | proc->addArgument( channel ); |
836 | if ( message.find (" " ) > 0 ) { | 838 | if ( message.find (" " ) > 0 ) { |
837 | QStringList list = QStringList::split( " ", message ); | 839 | QStringList list = QStringList::split( " ", message ); |
838 | int i = 0; | 840 | int i = 0; |
839 | while ( i < list.count ( ) ) { | 841 | while ( i < list.count ( ) ) { |
840 | //qDebug("add%sdd ",list[i].latin1() ); | 842 | //qDebug("add%sdd ",list[i].latin1() ); |
841 | proc->addArgument( list[i] ); | 843 | proc->addArgument( list[i] ); |
842 | //KMessageBox::sorry( 0,list[i]); | 844 | //KMessageBox::sorry( 0,list[i]); |
843 | ++i; | 845 | ++i; |
844 | } | 846 | } |
845 | } else { | 847 | } else { |
846 | proc->addArgument(message ); | 848 | proc->addArgument(message ); |
847 | 849 | ||
848 | } | 850 | } |
849 | parameters = translateMessage(parameters, name, emailadress); | 851 | parameters = translateMessage(parameters, name, emailadress); |
850 | 852 | ||
851 | //KMessageBox::information(0,parameters); | 853 | //KMessageBox::information(0,parameters); |
852 | proc->addArgument( parameters ); | 854 | proc->addArgument( parameters ); |
853 | proc->launch(""); | 855 | proc->launch(QString()); |
854 | #endif | 856 | #endif |
855 | 857 | ||
856 | return true; | 858 | return true; |
857 | } | 859 | } |
858 | 860 | ||
859 | /************************************************************************** | 861 | /************************************************************************** |
860 | * | 862 | * |
861 | **************************************************************************/ | 863 | **************************************************************************/ |
862 | 864 | ||
863 | //calls the emailapplication and creates a mail with parameter as recipients | 865 | //calls the emailapplication and creates a mail with parameter as recipients |
864 | // parameters format is | 866 | // parameters format is |
865 | // NAME <EMAIL>:SUBJECT | 867 | // NAME <EMAIL>:SUBJECT |
866 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 868 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
867 | { | 869 | { |
868 | QString line = adressline; | 870 | QString line = adressline; |
869 | 871 | ||
870 | int first = line.find( "<"); | 872 | int first = line.find( "<"); |
871 | int last = line.find( ">"); | 873 | int last = line.find( ">"); |
872 | QString name = line.left(first); | 874 | QString name = line.left(first); |
873 | QString emailadress = line.mid(first+1, last-first-1); | 875 | QString emailadress = line.mid(first+1, last-first-1); |
874 | 876 | ||
875 | //Subject can not be handled right now. | 877 | //Subject can not be handled right now. |
876 | return mailToOneContact( name, emailadress ); | 878 | return mailToOneContact( name, emailadress ); |
877 | 879 | ||
878 | } | 880 | } |
879 | 881 | ||
880 | 882 | ||
881 | /************************************************************************** | 883 | /************************************************************************** |
882 | * | 884 | * |
883 | **************************************************************************/ | 885 | **************************************************************************/ |
884 | 886 | ||
885 | //calls the phoneapplication with the number | 887 | //calls the phoneapplication with the number |
886 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 888 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
887 | { | 889 | { |
888 | #ifndef DESKTOP_VERSION | 890 | #ifndef DESKTOP_VERSION |
889 | QString channel; | 891 | QString channel; |
890 | QString message; | 892 | QString message; |
891 | QString parameters; | 893 | QString parameters; |
892 | 894 | ||
893 | 895 | ||
894 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 896 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
895 | if (client == KPimGlobalPrefs::OTHER_PHC) | 897 | if (client == KPimGlobalPrefs::OTHER_PHC) |
896 | { | 898 | { |
897 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 899 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
898 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 900 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
899 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 901 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
900 | } | 902 | } |
901 | else | 903 | else |
902 | { | 904 | { |
903 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 905 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
904 | if (!dai) | 906 | if (!dai) |
905 | { | 907 | { |
906 | qDebug("could not find configured phone application."); | 908 | qDebug("could not find configured phone application."); |
907 | return false; | 909 | return false; |
908 | } | 910 | } |
909 | channel = dai->_channel; | 911 | channel = dai->_channel; |
910 | message = dai->_message; | 912 | message = dai->_message; |
911 | parameters = dai->_parameters; | 913 | parameters = dai->_parameters; |
912 | } | 914 | } |
913 | 915 | ||
914 | 916 | ||
915 | //first check if one of the mailers need the emails right in the message. | 917 | //first check if one of the mailers need the emails right in the message. |
916 | message = translateMessage(message, phonenumber, ""); | 918 | message = translateMessage(message, phonenumber, ""); |
917 | 919 | ||
@@ -1171,129 +1173,129 @@ bool ExternalAppHandler::callBySIP( const QString& sipnumber ) | |||
1171 | 1173 | ||
1172 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 1174 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
1173 | { | 1175 | { |
1174 | message = message.replace( QRegExp("%1"), param1 ); | 1176 | message = message.replace( QRegExp("%1"), param1 ); |
1175 | return message.replace( QRegExp("%2"), param2 ); | 1177 | return message.replace( QRegExp("%2"), param2 ); |
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | /************************************************************************** | 1180 | /************************************************************************** |
1179 | * | 1181 | * |
1180 | **************************************************************************/ | 1182 | **************************************************************************/ |
1181 | 1183 | ||
1182 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 1184 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
1183 | { | 1185 | { |
1184 | #ifndef DESKTOP_VERSION | 1186 | #ifndef DESKTOP_VERSION |
1185 | QMap<QString, QString> valmap; | 1187 | QMap<QString, QString> valmap; |
1186 | bool useValMap = false; | 1188 | bool useValMap = false; |
1187 | 1189 | ||
1188 | // first extract all parts of the parameters. | 1190 | // first extract all parts of the parameters. |
1189 | QStringList paramlist = QStringList::split(";", parameters); | 1191 | QStringList paramlist = QStringList::split(";", parameters); |
1190 | 1192 | ||
1191 | //Now check how many parts we have. | 1193 | //Now check how many parts we have. |
1192 | //=0 :no params to pass | 1194 | //=0 :no params to pass |
1193 | //>0 :parameters to pass | 1195 | //>0 :parameters to pass |
1194 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 1196 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
1195 | { | 1197 | { |
1196 | QString param = (*it); | 1198 | QString param = (*it); |
1197 | QStringList keyvallist = QStringList::split("=", param); | 1199 | QStringList keyvallist = QStringList::split("=", param); |
1198 | 1200 | ||
1199 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 1201 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
1200 | QStringList::Iterator it2 = keyvallist.begin(); | 1202 | QStringList::Iterator it2 = keyvallist.begin(); |
1201 | QString key = (*it2); | 1203 | QString key = (*it2); |
1202 | key = key.replace( QRegExp("%1"), param1 ); | 1204 | key = key.replace( QRegExp("%1"), param1 ); |
1203 | key = key.replace( QRegExp("%2"), param2 ); | 1205 | key = key.replace( QRegExp("%2"), param2 ); |
1204 | ++it2; | 1206 | ++it2; |
1205 | 1207 | ||
1206 | if(it2 != keyvallist.end()) | 1208 | if(it2 != keyvallist.end()) |
1207 | { | 1209 | { |
1208 | QString value = (*it2); | 1210 | QString value = (*it2); |
1209 | value = value.replace( QRegExp("%1"), param1 ); | 1211 | value = value.replace( QRegExp("%1"), param1 ); |
1210 | value = value.replace( QRegExp("%2"), param2 ); | 1212 | value = value.replace( QRegExp("%2"), param2 ); |
1211 | 1213 | ||
1212 | valmap.insert(key, value); | 1214 | valmap.insert(key, value); |
1213 | useValMap = true; | 1215 | useValMap = true; |
1214 | } | 1216 | } |
1215 | else | 1217 | else |
1216 | { | 1218 | { |
1217 | // qDebug("pass parameter << %s", key.latin1()); | 1219 | // qDebug("pass parameter << %s", key.latin1()); |
1218 | (*e) << key; | 1220 | (*e) << key; |
1219 | } | 1221 | } |
1220 | } | 1222 | } |
1221 | 1223 | ||
1222 | if (useValMap == true) | 1224 | if (useValMap == true) |
1223 | (*e) << valmap; | 1225 | (*e) << valmap; |
1224 | 1226 | ||
1225 | #endif | 1227 | #endif |
1226 | 1228 | ||
1227 | } | 1229 | } |
1228 | 1230 | ||
1229 | 1231 | ||
1230 | 1232 | ||
1231 | /************************************************************************** | 1233 | /************************************************************************** |
1232 | * | 1234 | * |
1233 | **************************************************************************/ | 1235 | **************************************************************************/ |
1234 | 1236 | ||
1235 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 1237 | void ExternalAppHandler::appMessage( const Q3CString& cmsg, const QByteArray& data ) |
1236 | { | 1238 | { |
1237 | qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this); | 1239 | qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this); |
1238 | if ( cmsg == "nextView()" ) { | 1240 | if ( cmsg == "nextView()" ) { |
1239 | qDebug("nextView()"); | 1241 | qDebug("nextView()"); |
1240 | QTimer::singleShot( 0, this, SIGNAL ( nextView() )); | 1242 | QTimer::singleShot( 0, this, SIGNAL ( nextView() )); |
1241 | return; | 1243 | return; |
1242 | } | 1244 | } |
1243 | if ( cmsg == "callContactdialog()" ) { | 1245 | if ( cmsg == "callContactdialog()" ) { |
1244 | qDebug("callContactdialog()"); | 1246 | qDebug("callContactdialog()"); |
1245 | QTimer::singleShot( 0, this, SIGNAL ( callContactdialog() )); | 1247 | QTimer::singleShot( 0, this, SIGNAL ( callContactdialog() )); |
1246 | return; | 1248 | return; |
1247 | } | 1249 | } |
1248 | if ( cmsg == "doRingSync" ) { | 1250 | if ( cmsg == "doRingSync" ) { |
1249 | qDebug("doRingSync"); | 1251 | qDebug("doRingSync"); |
1250 | QTimer::singleShot( 0, this, SIGNAL ( doRingSync() )); | 1252 | QTimer::singleShot( 0, this, SIGNAL ( doRingSync() )); |
1251 | return; | 1253 | return; |
1252 | } | 1254 | } |
1253 | 1255 | ||
1254 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1256 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1255 | if (!res) | 1257 | if (!res) |
1256 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); | 1258 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); |
1257 | 1259 | ||
1258 | if (!res) | 1260 | if (!res) |
1259 | res = mDisplayDetails->appMessage( cmsg, data ); | 1261 | res = mDisplayDetails->appMessage( cmsg, data ); |
1260 | 1262 | ||
1261 | // if (!res) | 1263 | // if (!res) |
1262 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1264 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1263 | } | 1265 | } |
1264 | 1266 | ||
1265 | 1267 | ||
1266 | 1268 | ||
1267 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1269 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1268 | { | 1270 | { |
1269 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1271 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1270 | // maybe we are sending to KA/Pi fom a different worldd... | 1272 | // maybe we are sending to KA/Pi fom a different worldd... |
1271 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application | 1273 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application |
1272 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi | 1274 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi |
1273 | //qDebug("UID %s ", sessionuid.latin1()); | 1275 | //qDebug("UID %s ", sessionuid.latin1()); |
1274 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); | 1276 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); |
1275 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1277 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1276 | } | 1278 | } |
1277 | 1279 | ||
1278 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1280 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1279 | { | 1281 | { |
1280 | QStringList list4, list5, list6; | 1282 | QStringList list4, list5, list6; |
1281 | 1283 | ||
1282 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1284 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1283 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1285 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1284 | } | 1286 | } |
1285 | 1287 | ||
1286 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) | 1288 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
1287 | { | 1289 | { |
1288 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1290 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1289 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 1291 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
1290 | } | 1292 | } |
1291 | 1293 | ||
1292 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1294 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1293 | { | 1295 | { |
1294 | QStringList list4, list5, list6; | 1296 | QStringList list4, list5, list6; |
1295 | 1297 | ||
1296 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1298 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1297 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1299 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1298 | } | 1300 | } |
1299 | 1301 | ||
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index b899ad7..3247fe4 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -1,294 +1,297 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | #include <Q3PtrList> | ||
38 | //Added by qt3to4: | ||
39 | #include <Q3CString> | ||
37 | 40 | ||
38 | class QCopEnvelope; | 41 | class QCopEnvelope; |
39 | 42 | ||
40 | 43 | ||
41 | class ExternalAppHandler; | 44 | class ExternalAppHandler; |
42 | class QCopTransferItem : public QObject | 45 | class QCopTransferItem : public QObject |
43 | { | 46 | { |
44 | Q_OBJECT | 47 | Q_OBJECT |
45 | public: | 48 | public: |
46 | QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 49 | QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
47 | QCopTransferItem(); | 50 | QCopTransferItem(); |
48 | 51 | ||
49 | bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); | 52 | bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); |
50 | 53 | ||
51 | void setSourceChannel(const QString& sourceChannel); | 54 | void setSourceChannel(const QString& sourceChannel); |
52 | 55 | ||
53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 56 | virtual bool appMessage( const Q3CString& msg, const QByteArray& data ); |
54 | 57 | ||
55 | 58 | ||
56 | signals: | 59 | signals: |
57 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); | 60 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); |
58 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); | 61 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); |
59 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); | 62 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); |
60 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); | 63 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); |
61 | 64 | ||
62 | public: | 65 | public: |
63 | int _usedSourceParameters; | 66 | int _usedSourceParameters; |
64 | QString _sourceChannel; | 67 | QString _sourceChannel; |
65 | QString _sourceMessage; | 68 | QString _sourceMessage; |
66 | QString _sourceMessageParameters; | 69 | QString _sourceMessageParameters; |
67 | QString _targetChannel; | 70 | QString _targetChannel; |
68 | QString _targetMessage; | 71 | QString _targetMessage; |
69 | QString _targetMessageParameters; | 72 | QString _targetMessageParameters; |
70 | 73 | ||
71 | }; | 74 | }; |
72 | 75 | ||
73 | /********************************************************************************* | 76 | /********************************************************************************* |
74 | * | 77 | * |
75 | ********************************************************************************/ | 78 | ********************************************************************************/ |
76 | 79 | ||
77 | class QCopMapTransferItem : public QCopTransferItem | 80 | class QCopMapTransferItem : public QCopTransferItem |
78 | { | 81 | { |
79 | Q_OBJECT | 82 | Q_OBJECT |
80 | public: | 83 | public: |
81 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 84 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
82 | 85 | ||
83 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 86 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
84 | 87 | ||
85 | 88 | ||
86 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 89 | virtual bool appMessage( const Q3CString& msg, const QByteArray& data ); |
87 | 90 | ||
88 | 91 | ||
89 | signals: | 92 | signals: |
90 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 93 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
91 | 94 | ||
92 | }; | 95 | }; |
93 | 96 | ||
94 | /********************************************************************************* | 97 | /********************************************************************************* |
95 | * | 98 | * |
96 | ********************************************************************************/ | 99 | ********************************************************************************/ |
97 | 100 | ||
98 | class QCopListTransferItem : public QCopTransferItem | 101 | class QCopListTransferItem : public QCopTransferItem |
99 | { | 102 | { |
100 | Q_OBJECT | 103 | Q_OBJECT |
101 | public: | 104 | public: |
102 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 105 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
103 | ~QCopListTransferItem(); | 106 | ~QCopListTransferItem(); |
104 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); | 107 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); |
105 | 108 | ||
106 | 109 | ||
107 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 110 | virtual bool appMessage( const Q3CString& msg, const QByteArray& data ); |
108 | 111 | ||
109 | 112 | ||
110 | signals: | 113 | signals: |
111 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); | 114 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); |
112 | 115 | ||
113 | }; | 116 | }; |
114 | 117 | ||
115 | /********************************************************************************* | 118 | /********************************************************************************* |
116 | * | 119 | * |
117 | ********************************************************************************/ | 120 | ********************************************************************************/ |
118 | 121 | ||
119 | 122 | ||
120 | class DefaultAppItem | 123 | class DefaultAppItem |
121 | { | 124 | { |
122 | public: | 125 | public: |
123 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) | 126 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) |
124 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) | 127 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) |
125 | {} | 128 | {} |
126 | 129 | ||
127 | DefaultAppItem() | 130 | DefaultAppItem() |
128 | { } | 131 | { } |
129 | 132 | ||
130 | public: | 133 | public: |
131 | int _type; | 134 | int _type; |
132 | int _id; | 135 | int _id; |
133 | QString _label; | 136 | QString _label; |
134 | QString _channel; | 137 | QString _channel; |
135 | QString _message; | 138 | QString _message; |
136 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; | 139 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; |
137 | QString _message2; | 140 | QString _message2; |
138 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; | 141 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; |
139 | 142 | ||
140 | }; | 143 | }; |
141 | 144 | ||
142 | /********************************************************************************* | 145 | /********************************************************************************* |
143 | * | 146 | * |
144 | ********************************************************************************/ | 147 | ********************************************************************************/ |
145 | 148 | ||
146 | class ExternalAppHandler : public QObject | 149 | class ExternalAppHandler : public QObject |
147 | { | 150 | { |
148 | Q_OBJECT | 151 | Q_OBJECT |
149 | public: | 152 | public: |
150 | virtual ~ExternalAppHandler(); | 153 | virtual ~ExternalAppHandler(); |
151 | 154 | ||
152 | static ExternalAppHandler *instance(); | 155 | static ExternalAppHandler *instance(); |
153 | 156 | ||
154 | enum Types { | 157 | enum Types { |
155 | EMAIL = 0, | 158 | EMAIL = 0, |
156 | PHONE = 1, | 159 | PHONE = 1, |
157 | SMS = 2, | 160 | SMS = 2, |
158 | FAX = 3, | 161 | FAX = 3, |
159 | PAGER = 4, | 162 | PAGER = 4, |
160 | SIP = 5 | 163 | SIP = 5 |
161 | }; | 164 | }; |
162 | 165 | ||
163 | enum Availability { | 166 | enum Availability { |
164 | UNDEFINED = -1, | 167 | UNDEFINED = -1, |
165 | UNAVAILABLE = 0, | 168 | UNAVAILABLE = 0, |
166 | AVAILABLE = 1 | 169 | AVAILABLE = 1 |
167 | }; | 170 | }; |
168 | 171 | ||
169 | //calls the emailapplication with a number of attachments that need to be send. | 172 | //calls the emailapplication with a number of attachments that need to be send. |
170 | //either parameter can be left empty. | 173 | //either parameter can be left empty. |
171 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); | 174 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); |
172 | 175 | ||
173 | //calls the emailapplication and creates a mail with parameter emailadress as recipients | 176 | //calls the emailapplication and creates a mail with parameter emailadress as recipients |
174 | bool mailToOneContact( const QString& name, const QString& emailadress ); | 177 | bool mailToOneContact( const QString& name, const QString& emailadress ); |
175 | 178 | ||
176 | //calls the emailapplication and creates a mail with parameter as recipients | 179 | //calls the emailapplication and creates a mail with parameter as recipients |
177 | // parameters format is | 180 | // parameters format is |
178 | // NAME <EMAIL>:SUBJECT | 181 | // NAME <EMAIL>:SUBJECT |
179 | bool mailToOneContact( const QString& adressline ); | 182 | bool mailToOneContact( const QString& adressline ); |
180 | 183 | ||
181 | //calls the phoneapplication with the number | 184 | //calls the phoneapplication with the number |
182 | bool callByPhone( const QString& phonenumber ); | 185 | bool callByPhone( const QString& phonenumber ); |
183 | 186 | ||
184 | //calls the smsapplication with the number | 187 | //calls the smsapplication with the number |
185 | bool callBySMS( const QString& phonenumber ); | 188 | bool callBySMS( const QString& phonenumber ); |
186 | 189 | ||
187 | //calls the pagerapplication with the number | 190 | //calls the pagerapplication with the number |
188 | bool callByPager( const QString& pagernumber ); | 191 | bool callByPager( const QString& pagernumber ); |
189 | 192 | ||
190 | //calls the faxapplication with the number | 193 | //calls the faxapplication with the number |
191 | bool callByFax( const QString& faxnumber ); | 194 | bool callByFax( const QString& faxnumber ); |
192 | 195 | ||
193 | //calls the sipapplication with the number | 196 | //calls the sipapplication with the number |
194 | bool callBySIP( const QString& sipnumber ); | 197 | bool callBySIP( const QString& sipnumber ); |
195 | 198 | ||
196 | bool isEmailAppAvailable(); | 199 | bool isEmailAppAvailable(); |
197 | bool isSMSAppAvailable(); | 200 | bool isSMSAppAvailable(); |
198 | bool isPhoneAppAvailable(); | 201 | bool isPhoneAppAvailable(); |
199 | bool isFaxAppAvailable(); | 202 | bool isFaxAppAvailable(); |
200 | bool isPagerAppAvailable(); | 203 | bool isPagerAppAvailable(); |
201 | bool isSIPAppAvailable(); | 204 | bool isSIPAppAvailable(); |
202 | 205 | ||
203 | 206 | ||
204 | //Call this method on the source when you want to select names from the addressbook by using QCop | 207 | //Call this method on the source when you want to select names from the addressbook by using QCop |
205 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); | 208 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
206 | //Call this method on the target when you want to return the name/email map to the source (client). | 209 | //Call this method on the target when you want to return the name/email map to the source (client). |
207 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 210 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
208 | 211 | ||
209 | 212 | ||
210 | 213 | ||
211 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); | 214 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); |
212 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 215 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
213 | 216 | ||
214 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); | 217 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); |
215 | 218 | ||
216 | 219 | ||
217 | 220 | ||
218 | bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); | 221 | bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
219 | bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, | 222 | bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, |
220 | const QStringList& birthdayList, const QStringList& anniversaryList, | 223 | const QStringList& birthdayList, const QStringList& anniversaryList, |
221 | const QStringList& realNameList, const QStringList& emailList, | 224 | const QStringList& realNameList, const QStringList& emailList, |
222 | const QStringList& assembledNameList, const QStringList& uidList); | 225 | const QStringList& assembledNameList, const QStringList& uidList); |
223 | 226 | ||
224 | 227 | ||
225 | //loadConfig clears the cache and checks again if the applications are available or not | 228 | //loadConfig clears the cache and checks again if the applications are available or not |
226 | void loadConfig(); | 229 | void loadConfig(); |
227 | 230 | ||
228 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 231 | Q3PtrList<DefaultAppItem> getAvailableDefaultItems(Types); |
229 | DefaultAppItem* getDefaultItem(Types, int); | 232 | DefaultAppItem* getDefaultItem(Types, int); |
230 | 233 | ||
231 | public slots: | 234 | public slots: |
232 | void appMessage( const QCString& msg, const QByteArray& data ); | 235 | void appMessage( const Q3CString& msg, const QByteArray& data ); |
233 | 236 | ||
234 | 237 | ||
235 | signals: | 238 | signals: |
236 | void callContactdialog(); | 239 | void callContactdialog(); |
237 | void nextView(); | 240 | void nextView(); |
238 | void doRingSync(); | 241 | void doRingSync(); |
239 | // Emmitted when the target app receives a request from the source app | 242 | // Emmitted when the target app receives a request from the source app |
240 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); | 243 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); |
241 | 244 | ||
242 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 245 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
243 | // The first parameter is a uniqueid. It can be used to identify the event | 246 | // The first parameter is a uniqueid. It can be used to identify the event |
244 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 247 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
245 | 248 | ||
246 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | 249 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); |
247 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 250 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
248 | 251 | ||
249 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 252 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
250 | 253 | ||
251 | 254 | ||
252 | // Emmitted when the target app receives a request from the source app | 255 | // Emmitted when the target app receives a request from the source app |
253 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); | 256 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); |
254 | 257 | ||
255 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 258 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
256 | // The first parameter is a uniqueid. It can be used to identify the event | 259 | // The first parameter is a uniqueid. It can be used to identify the event |
257 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, | 260 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, |
258 | const QStringList& anniversaryList, const QStringList& realNameList, | 261 | const QStringList& anniversaryList, const QStringList& realNameList, |
259 | const QStringList& emailList, const QStringList& assembledNameList, | 262 | const QStringList& emailList, const QStringList& assembledNameList, |
260 | const QStringList& uidList); | 263 | const QStringList& uidList); |
261 | 264 | ||
262 | 265 | ||
263 | private: | 266 | private: |
264 | ExternalAppHandler(); | 267 | ExternalAppHandler(); |
265 | QList<DefaultAppItem> mDefaultItems; | 268 | Q3PtrList<DefaultAppItem> mDefaultItems; |
266 | 269 | ||
267 | Availability mEmailAppAvailable; | 270 | Availability mEmailAppAvailable; |
268 | Availability mPhoneAppAvailable; | 271 | Availability mPhoneAppAvailable; |
269 | Availability mFaxAppAvailable; | 272 | Availability mFaxAppAvailable; |
270 | Availability mSMSAppAvailable; | 273 | Availability mSMSAppAvailable; |
271 | Availability mPagerAppAvailable; | 274 | Availability mPagerAppAvailable; |
272 | Availability mSIPAppAvailable; | 275 | Availability mSIPAppAvailable; |
273 | 276 | ||
274 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | 277 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; |
275 | QCopListTransferItem* mFindByEmailFromKAPITransfer; | 278 | QCopListTransferItem* mFindByEmailFromKAPITransfer; |
276 | QCopTransferItem* mDisplayDetails; | 279 | QCopTransferItem* mDisplayDetails; |
277 | QCopListTransferItem* mBirthdayListFromKAPITransfer; | 280 | QCopListTransferItem* mBirthdayListFromKAPITransfer; |
278 | 281 | ||
279 | 282 | ||
280 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 283 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
281 | 284 | ||
282 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; | 285 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
283 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; | 286 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
284 | 287 | ||
285 | 288 | ||
286 | static ExternalAppHandler *sInstance; | 289 | static ExternalAppHandler *sInstance; |
287 | 290 | ||
288 | private slots: | 291 | private slots: |
289 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); | 292 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); |
290 | 293 | ||
291 | }; | 294 | }; |
292 | 295 | ||
293 | 296 | ||
294 | #endif | 297 | #endif |
diff --git a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp index 5094830..9f47766 100644 --- a/libkdepim/kcmconfigs/kcmkdepimconfig.cpp +++ b/libkdepim/kcmconfigs/kcmkdepimconfig.cpp | |||
@@ -1,80 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDEPim/Pi. | 2 | This file is part of KDEPim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3VBoxLayout> | ||
33 | 35 | ||
34 | #include <kdebug.h> | 36 | #include <kdebug.h> |
35 | //#include <klocale.h> | 37 | //#include <klocale.h> |
36 | //#include <stdlib.h> | 38 | //#include <stdlib.h> |
37 | 39 | ||
38 | #include "kdepimconfigwidget.h" | 40 | #include "kdepimconfigwidget.h" |
39 | 41 | ||
40 | #include "kcmkdepimconfig.h" | 42 | #include "kcmkdepimconfig.h" |
41 | #include "kprefs.h" | 43 | #include "kprefs.h" |
42 | #include "kpimglobalprefs.h" | 44 | #include "kpimglobalprefs.h" |
43 | 45 | ||
44 | #ifndef _WIN32_ | 46 | #ifndef _WIN32_ |
45 | extern "C" | 47 | extern "C" |
46 | { | 48 | { |
47 | KCModule *create_kdepimconfig(QWidget *parent, const char * ) { | 49 | KCModule *create_kdepimconfig(QWidget *parent, const char * ) { |
48 | return new KCMKdePimConfig(parent, "kcmkdepimconfig" ); | 50 | return new KCMKdePimConfig(parent, "kcmkdepimconfig" ); |
49 | } | 51 | } |
50 | } | 52 | } |
51 | #endif | 53 | #endif |
52 | 54 | ||
53 | KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name ) | 55 | KCMKdePimConfig::KCMKdePimConfig(QWidget *parent, const char *name ) |
54 | : KCModule( KPimGlobalPrefs::instance(), parent, name ) | 56 | : KCModule( KPimGlobalPrefs::instance(), parent, name ) |
55 | { | 57 | { |
56 | //abort(); | 58 | //abort(); |
57 | QVBoxLayout *layout = new QVBoxLayout( this ); | 59 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
58 | mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" ); | 60 | mConfigWidget = new KDEPIMConfigWidget( (KPimGlobalPrefs*)getPreferences(), this, "KDEPIMConfigWidget" ); |
59 | layout->addWidget( mConfigWidget ); | 61 | layout->addWidget( mConfigWidget ); |
60 | layout->setSpacing( 0 ); | 62 | layout->setSpacing( 0 ); |
61 | layout->setMargin( 0 ); | 63 | layout->setMargin( 0 ); |
62 | 64 | ||
63 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 65 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
64 | } | 66 | } |
65 | 67 | ||
66 | void KCMKdePimConfig::load() | 68 | void KCMKdePimConfig::load() |
67 | { | 69 | { |
68 | mConfigWidget->readConfig(); | 70 | mConfigWidget->readConfig(); |
69 | } | 71 | } |
70 | 72 | ||
71 | void KCMKdePimConfig::save() | 73 | void KCMKdePimConfig::save() |
72 | { | 74 | { |
73 | mConfigWidget->writeConfig(); | 75 | mConfigWidget->writeConfig(); |
74 | } | 76 | } |
75 | 77 | ||
76 | void KCMKdePimConfig::defaults() | 78 | void KCMKdePimConfig::defaults() |
77 | { | 79 | { |
78 | qDebug("KCMKdePimConfig::defaults()"); | 80 | qDebug("KCMKdePimConfig::defaults()"); |
79 | mConfigWidget->setDefaults(); | 81 | mConfigWidget->setDefaults(); |
80 | } | 82 | } |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index 292951b..11a2b45 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp | |||
@@ -1,617 +1,622 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KdePim/Pi. | 2 | This file is part of KdePim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <qlayout.h> | 31 | #include <qlayout.h> |
32 | #include <qtabwidget.h> | 32 | #include <qtabwidget.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qgroupbox.h> | 34 | #include <q3groupbox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qbuttongroup.h> | 37 | #include <q3buttongroup.h> |
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <qvbox.h> | 40 | #include <q3vbox.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
44 | #include <QDesktopWidget> | ||
45 | //Added by qt3to4: | ||
46 | #include <Q3HBoxLayout> | ||
47 | #include <Q3GridLayout> | ||
48 | #include <Q3VBoxLayout> | ||
44 | 49 | ||
45 | #include <kdialog.h> | 50 | #include <kdialog.h> |
46 | #include <kprefsdialog.h> | 51 | #include <kprefsdialog.h> |
47 | #include <klocale.h> | 52 | #include <klocale.h> |
48 | #include <kglobalsettings.h> | 53 | #include <kglobalsettings.h> |
49 | #include <kdateedit.h> | 54 | #include <kdateedit.h> |
50 | #include <kglobal.h> | 55 | #include <kglobal.h> |
51 | #include <stdlib.h> | 56 | #include <stdlib.h> |
52 | 57 | ||
53 | /*US | 58 | /*US |
54 | #include <qcheckbox.h> | 59 | #include <qcheckbox.h> |
55 | #include <qframe.h> | 60 | #include <qframe.h> |
56 | #include <qpushbutton.h> | 61 | #include <qpushbutton.h> |
57 | #include <qcombobox.h> | 62 | #include <qcombobox.h> |
58 | #include <qlineedit.h> | 63 | #include <qlineedit.h> |
59 | #include <qlabel.h> | 64 | #include <qlabel.h> |
60 | #include <qfile.h> | 65 | #include <qfile.h> |
61 | 66 | ||
62 | #include <kconfig.h> | 67 | #include <kconfig.h> |
63 | #include <kdebug.h> | 68 | #include <kdebug.h> |
64 | #include <kdialog.h> | 69 | #include <kdialog.h> |
65 | #include <klistview.h> | 70 | #include <klistview.h> |
66 | #include <klocale.h> | 71 | #include <klocale.h> |
67 | #include <kglobal.h> | 72 | #include <kglobal.h> |
68 | #include <kmessagebox.h> | 73 | #include <kmessagebox.h> |
69 | #include <kstandarddirs.h> | 74 | #include <kstandarddirs.h> |
70 | 75 | ||
71 | #ifndef KAB_EMBEDDED | 76 | #ifndef KAB_EMBEDDED |
72 | #include <ktrader.h> | 77 | #include <ktrader.h> |
73 | #else // KAB_EMBEDDED | 78 | #else // KAB_EMBEDDED |
74 | #include <mergewidget.h> | 79 | #include <mergewidget.h> |
75 | #include <distributionlistwidget.h> | 80 | #include <distributionlistwidget.h> |
76 | #endif // KAB_EMBEDDED | 81 | #endif // KAB_EMBEDDED |
77 | 82 | ||
78 | #include "addresseewidget.h" | 83 | #include "addresseewidget.h" |
79 | #include "extensionconfigdialog.h" | 84 | #include "extensionconfigdialog.h" |
80 | #include "extensionwidget.h" | 85 | #include "extensionwidget.h" |
81 | */ | 86 | */ |
82 | 87 | ||
83 | #include "qapplication.h" | 88 | #include "qapplication.h" |
84 | 89 | ||
85 | #include "kpimglobalprefs.h" | 90 | #include "kpimglobalprefs.h" |
86 | 91 | ||
87 | #include "kdepimconfigwidget.h" | 92 | #include "kdepimconfigwidget.h" |
88 | #include <kprefs.h> | 93 | #include <kprefs.h> |
89 | #include <kmessagebox.h> | 94 | #include <kmessagebox.h> |
90 | 95 | ||
91 | 96 | ||
92 | 97 | ||
93 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) | 98 | KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) |
94 | : KPrefsWidget(prefs, parent, name ) | 99 | : KPrefsWidget(prefs, parent, name ) |
95 | { | 100 | { |
96 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); | 101 | mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); |
97 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); | 102 | mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); |
98 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); | 103 | mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); |
99 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); | 104 | mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); |
100 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); | 105 | mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); |
101 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); | 106 | mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); |
102 | 107 | ||
103 | 108 | ||
104 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 109 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0, |
105 | KDialog::spacingHint() ); | 110 | KDialog::spacingHint() ); |
106 | 111 | ||
107 | tabWidget = new QTabWidget( this ); | 112 | tabWidget = new QTabWidget( this ); |
108 | topLayout->addWidget( tabWidget ); | 113 | topLayout->addWidget( tabWidget ); |
109 | 114 | ||
110 | 115 | ||
111 | setupLocaleTab(); | 116 | setupLocaleTab(); |
112 | setupLocaleDateTab(); | 117 | setupLocaleDateTab(); |
113 | setupTimeZoneTab(); | 118 | setupTimeZoneTab(); |
114 | setupExternalAppTab(); | 119 | setupExternalAppTab(); |
115 | setupStoreTab(); | 120 | setupStoreTab(); |
116 | setupBackupTab(); | 121 | setupBackupTab(); |
117 | } | 122 | } |
118 | void KDEPIMConfigWidget::showTimeZoneTab() | 123 | void KDEPIMConfigWidget::showTimeZoneTab() |
119 | { | 124 | { |
120 | tabWidget->setCurrentPage ( 3 ) ; | 125 | tabWidget->setCurrentPage ( 3 ) ; |
121 | } | 126 | } |
122 | void KDEPIMConfigWidget::setupBackupTab() | 127 | void KDEPIMConfigWidget::setupBackupTab() |
123 | { | 128 | { |
124 | QVBox *colorPage = new QVBox( this ); | 129 | Q3VBox *colorPage = new Q3VBox( this ); |
125 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); | 130 | tabWidget->addTab( colorPage, i18n( "Backup" ) ); |
126 | QWidget* topFrame = new QWidget( colorPage ); | 131 | QWidget* topFrame = new QWidget( colorPage ); |
127 | QVBoxLayout *topLayout = new QVBoxLayout(topFrame); | 132 | Q3VBoxLayout *topLayout = new Q3VBoxLayout(topFrame); |
128 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), | 133 | KPrefsWidBool *sb = addWidBool(i18n("Backup enabled"), |
129 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); | 134 | &(KPimGlobalPrefs::instance()->mBackupEnabled),topFrame); |
130 | topLayout->addWidget((QWidget*)sb->checkBox()); | 135 | topLayout->addWidget((QWidget*)sb->checkBox()); |
131 | QWidget* bupFrame = new QWidget( topFrame ); | 136 | QWidget* bupFrame = new QWidget( topFrame ); |
132 | topLayout->addWidget((bupFrame)); | 137 | topLayout->addWidget((bupFrame)); |
133 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); | 138 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), bupFrame, SLOT ( setEnabled( bool ) ) ); |
134 | QVBoxLayout *bupLayout = new QVBoxLayout(bupFrame); | 139 | Q3VBoxLayout *bupLayout = new Q3VBoxLayout(bupFrame); |
135 | sb = addWidBool(i18n("Use standard backup dir"), | 140 | sb = addWidBool(i18n("Use standard backup dir"), |
136 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); | 141 | &(KPimGlobalPrefs::instance()->mBackupUseDefaultDir),bupFrame); |
137 | bupLayout->addWidget((QWidget*)sb->checkBox()); | 142 | bupLayout->addWidget((QWidget*)sb->checkBox()); |
138 | mBackupUrl = new KURLRequester( bupFrame ); | 143 | mBackupUrl = new KURLRequester( bupFrame ); |
139 | mBackupUrl->setPathIsDir(); | 144 | mBackupUrl->setPathIsDir(); |
140 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); | 145 | mBackupUrl->setURL( KGlobalSettings::backupDataDir() ); |
141 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); | 146 | QObject::connect ( sb->checkBox(), SIGNAL (toggled ( bool ) ), mBackupUrl ,SLOT ( setDisabled( bool ) ) ); |
142 | bupLayout->addWidget( mBackupUrl ); | 147 | bupLayout->addWidget( mBackupUrl ); |
143 | 148 | ||
144 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); | 149 | mBackupUrl->setEnabled( !KPimGlobalPrefs::instance()->mBackupUseDefaultDir ); |
145 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); | 150 | bupFrame->setEnabled( KPimGlobalPrefs::instance()->mBackupEnabled ); |
146 | QHBox *dummy = new QHBox(bupFrame); | 151 | Q3HBox *dummy = new Q3HBox(bupFrame); |
147 | new QLabel(i18n("Number of Backups:"),dummy); | 152 | new QLabel(i18n("Number of Backups:"),dummy); |
148 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); | 153 | mBackupNumbersSpin = new QSpinBox(1,21,1,dummy); |
149 | new QLabel(i18n(" "),dummy); | 154 | new QLabel(i18n(" "),dummy); |
150 | bupLayout->addWidget( dummy ); | 155 | bupLayout->addWidget( dummy ); |
151 | 156 | ||
152 | dummy = new QHBox(bupFrame); | 157 | dummy = new Q3HBox(bupFrame); |
153 | new QLabel(i18n("Make backup every "),dummy); | 158 | new QLabel(i18n("Make backup every "),dummy); |
154 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); | 159 | mBackupDayCountSpin = new QSpinBox(1,28,1,dummy); |
155 | new QLabel(i18n(" days"),dummy); | 160 | new QLabel(i18n(" days"),dummy); |
156 | new QLabel(i18n(" "),dummy); | 161 | new QLabel(i18n(" "),dummy); |
157 | bupLayout->addWidget( dummy ); | 162 | bupLayout->addWidget( dummy ); |
158 | QString localKdeDir; | 163 | QString localKdeDir; |
159 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | 164 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); |
160 | if ( ! localKdeDir.isEmpty() ) { | 165 | if ( ! localKdeDir.isEmpty() ) { |
161 | sb->checkBox()->setEnabled( false ); | 166 | sb->checkBox()->setEnabled( false ); |
162 | sb->checkBox()->setChecked( true ); | 167 | sb->checkBox()->setChecked( true ); |
163 | mBackupUrl->setEnabled( false ); | 168 | mBackupUrl->setEnabled( false ); |
164 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; | 169 | KPimGlobalPrefs::instance()->mBackupUseDefaultDir = true; |
165 | } | 170 | } |
166 | 171 | ||
167 | } | 172 | } |
168 | void KDEPIMConfigWidget::setupStoreTab() | 173 | void KDEPIMConfigWidget::setupStoreTab() |
169 | { | 174 | { |
170 | QVBox *colorPage = new QVBox( this ); | 175 | Q3VBox *colorPage = new Q3VBox( this ); |
171 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); | 176 | tabWidget->addTab( colorPage, i18n( "Colors" ) ); |
172 | QWidget* cw = new QWidget( colorPage ); | 177 | QWidget* cw = new QWidget( colorPage ); |
173 | KPrefsWidColor *holidayColor = | 178 | KPrefsWidColor *holidayColor = |
174 | addWidColor(i18n("Alternating background of list views"), | 179 | addWidColor(i18n("Alternating background of list views"), |
175 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); | 180 | &(KPimGlobalPrefs::instance()->mAlternateColor),cw); |
176 | QHBoxLayout *topLayout = new QHBoxLayout(cw); | 181 | Q3HBoxLayout *topLayout = new Q3HBoxLayout(cw); |
177 | topLayout->addWidget(holidayColor->label()); | 182 | topLayout->addWidget(holidayColor->label()); |
178 | topLayout->addWidget( (QWidget* )holidayColor->button()); | 183 | topLayout->addWidget( (QWidget* )holidayColor->button()); |
179 | 184 | ||
180 | 185 | ||
181 | QVBox *storePage = new QVBox( this ); | 186 | Q3VBox *storePage = new Q3VBox( this ); |
182 | if ( QApplication::desktop()->height() > 240 ) | 187 | if ( QApplication::desktop()->height() > 240 ) |
183 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); | 188 | new QLabel( i18n("Your current storage dir is:\n%1\nYour mail is stored in:\n(storagedir)/apps/kopiemail/localmail").arg(KGlobal::dirs()->localkdedir()), storePage ); |
184 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); | 189 | new QLabel( i18n("<b>New data storage dir:</b>"), storePage ); |
185 | mStoreUrl = new KURLRequester( storePage ); | 190 | mStoreUrl = new KURLRequester( storePage ); |
186 | mStoreUrl->setPathIsDir(); | 191 | mStoreUrl->setPathIsDir(); |
187 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); | 192 | mStoreUrl->setURL( KGlobal::dirs()->localkdedir() ); |
188 | #ifdef DESKTOP_VERSION | 193 | #ifdef DESKTOP_VERSION |
189 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; | 194 | QString confFile = qApp->applicationDirPath ()+ "/.microkdehome" ; |
190 | QFileInfo fi ( confFile ); | 195 | QFileInfo fi ( confFile ); |
191 | if ( fi.exists() ) { | 196 | if ( fi.exists() ) { |
192 | KConfig cfg ( confFile ); | 197 | KConfig cfg ( confFile ); |
193 | cfg.setGroup("Global"); | 198 | cfg.setGroup("Global"); |
194 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); | 199 | QString localKdeDir = cfg.readEntry( "MICROKDEHOME", "x_x_x" ); |
195 | if ( localKdeDir != "x_x_x" ) { | 200 | if ( localKdeDir != "x_x_x" ) { |
196 | mStoreUrl->setURL( localKdeDir ); | 201 | mStoreUrl->setURL( localKdeDir ); |
197 | qDebug("Reading config from %s ", confFile.latin1()); | 202 | qDebug("Reading config from %s ", confFile.latin1()); |
198 | } | 203 | } |
199 | } | 204 | } |
200 | 205 | ||
201 | #endif | 206 | #endif |
202 | new QLabel( i18n("New dirs are created automatically"), storePage ); | 207 | new QLabel( i18n("New dirs are created automatically"), storePage ); |
203 | QHBox *bb = new QHBox( storePage ); | 208 | Q3HBox *bb = new Q3HBox( storePage ); |
204 | QPushButton * pb; | 209 | QPushButton * pb; |
205 | if ( QApplication::desktop()->width() < 640 ) | 210 | if ( QApplication::desktop()->width() < 640 ) |
206 | pb = new QPushButton ( i18n("Save"), bb ); | 211 | pb = new QPushButton ( i18n("Save"), bb ); |
207 | else | 212 | else |
208 | pb = new QPushButton ( i18n("Save settings"), bb ); | 213 | pb = new QPushButton ( i18n("Save settings"), bb ); |
209 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); | 214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( saveStoreSettings() ) ); |
210 | pb = new QPushButton ( i18n("Save standard"), bb ); | 215 | pb = new QPushButton ( i18n("Save standard"), bb ); |
211 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); | 216 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setStandardStore() ) ); |
212 | #ifdef DESKTOP_VERSION | 217 | #ifdef DESKTOP_VERSION |
213 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); | 218 | pb = new QPushButton ( i18n("Save using LOCAL storage"), bb ); |
214 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); | 219 | connect(pb, SIGNAL( clicked() ), this, SLOT ( setLocalStore() ) ); |
215 | #endif | 220 | #endif |
216 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); | 221 | new QLabel( i18n("<b>New settings are used\nafter a restart</b>"), storePage ); |
217 | mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); | 222 | mDataStoragePath = new QLabel( i18n("Settings are stored in\n%1").arg(QDir::homeDirPath() + "/.microkdehome" ), storePage ); |
218 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); | 223 | tabWidget->addTab( storePage, i18n( "Data storage path" ) ); |
219 | 224 | ||
220 | #ifdef DESKTOP_VERSION | 225 | #ifdef DESKTOP_VERSION |
221 | if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { | 226 | if ( mStoreUrl->url().startsWith( "LOCAL:" ) ) { |
222 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); | 227 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( qApp->applicationDirPath ()+"/.microkdehome" )); |
223 | } | 228 | } |
224 | #endif | 229 | #endif |
225 | } | 230 | } |
226 | void KDEPIMConfigWidget::setLocalStore() | 231 | void KDEPIMConfigWidget::setLocalStore() |
227 | { | 232 | { |
228 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); | 233 | mStoreUrl->setURL( "LOCAL:kdepimpi" ); |
229 | saveStoreSettings(); | 234 | saveStoreSettings(); |
230 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); | 235 | QString message = i18n("'LOCAL' mode makes is possible to run\nKA/Pi and KO/Pi from a USB memory stick.\nIn LOCAL mode the data is stored\nin a path relative to the executable.\nNote, that in LOCAL mode only addressbook\nresource files in\n <path of the executable>/<dirname after LOCAL:>/apps/kabc/*.vcf\n are supported.\nIf you use the standard addressbook settings\nyou do not have to reconfigure any path,\njust restart the application and import\nyour addressbook and calendar data."); |
231 | KMessageBox::information( this, message); | 236 | KMessageBox::information( this, message); |
232 | } | 237 | } |
233 | void KDEPIMConfigWidget::setStandardStore() | 238 | void KDEPIMConfigWidget::setStandardStore() |
234 | { | 239 | { |
235 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 240 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
236 | saveStoreSettings(); | 241 | saveStoreSettings(); |
237 | } | 242 | } |
238 | void KDEPIMConfigWidget::saveStoreSettings() | 243 | void KDEPIMConfigWidget::saveStoreSettings() |
239 | { | 244 | { |
240 | #ifdef DESKTOP_VERSION | 245 | #ifdef DESKTOP_VERSION |
241 | if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { | 246 | if ( !mStoreUrl->url().startsWith( "LOCAL:" ) ) { |
242 | QString file = qApp->applicationDirPath ()+"/.microkdehome"; | 247 | QString file = qApp->applicationDirPath ()+"/.microkdehome"; |
243 | QFileInfo fi ( file ); | 248 | QFileInfo fi ( file ); |
244 | if ( fi.exists() ) { | 249 | if ( fi.exists() ) { |
245 | bool res = QFile::remove( file ); | 250 | bool res = QFile::remove( file ); |
246 | if ( ! res ) | 251 | if ( ! res ) |
247 | KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); | 252 | KMessageBox::information( this, i18n("ERROR: Cannot remove file\n%1\nPlease remove it manually.").arg( file )); |
248 | } | 253 | } |
249 | } | 254 | } |
250 | #endif | 255 | #endif |
251 | if ( !mStoreUrl->url().isEmpty() ) { | 256 | if ( !mStoreUrl->url().isEmpty() ) { |
252 | QString path = QDir::homeDirPath(); | 257 | QString path = QDir::homeDirPath(); |
253 | QString url = mStoreUrl->url(); | 258 | QString url = mStoreUrl->url(); |
254 | #ifdef DESKTOP_VERSION | 259 | #ifdef DESKTOP_VERSION |
255 | if ( url.startsWith( "LOCAL:" ) ) { | 260 | if ( url.startsWith( "LOCAL:" ) ) { |
256 | path = qApp->applicationDirPath () ; | 261 | path = qApp->applicationDirPath () ; |
257 | } | 262 | } |
258 | #endif | 263 | #endif |
259 | KConfig cfg ( path + "/.microkdehome" ); | 264 | KConfig cfg ( path + "/.microkdehome" ); |
260 | cfg.setGroup("Global"); | 265 | cfg.setGroup("Global"); |
261 | cfg.writeEntry( "MICROKDEHOME", url ); | 266 | cfg.writeEntry( "MICROKDEHOME", url ); |
262 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); | 267 | qDebug("cfg.writeEntry( MICROKDEHOME, %s ", url.latin1()); |
263 | cfg.sync(); | 268 | cfg.sync(); |
264 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); | 269 | mDataStoragePath->setText( i18n("Settings are stored in\n%1").arg( path+"/.microkdehome" )); |
265 | } else { | 270 | } else { |
266 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); | 271 | mStoreUrl->setURL( QDir::homeDirPath() + "/kdepim" ); |
267 | saveStoreSettings(); | 272 | saveStoreSettings(); |
268 | } | 273 | } |
269 | } | 274 | } |
270 | void KDEPIMConfigWidget::setupExternalAppTab() | 275 | void KDEPIMConfigWidget::setupExternalAppTab() |
271 | { | 276 | { |
272 | QWidget *externalAppsPage = new QWidget( this ); | 277 | QWidget *externalAppsPage = new QWidget( this ); |
273 | QVBoxLayout* layout = new QVBoxLayout( externalAppsPage, KDialog::marginHintSmall(), | 278 | Q3VBoxLayout* layout = new Q3VBoxLayout( externalAppsPage, KDialog::marginHintSmall(), |
274 | KDialog::spacingHintSmall() ); | 279 | KDialog::spacingHintSmall() ); |
275 | 280 | ||
276 | mExternalApps = new QComboBox( externalAppsPage ); | 281 | mExternalApps = new QComboBox( externalAppsPage ); |
277 | 282 | ||
278 | QMap<ExternalAppHandler::Types, QString>::Iterator it; | 283 | QMap<ExternalAppHandler::Types, QString>::Iterator it; |
279 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) | 284 | for( it = mExternalAppsMap.begin(); it != mExternalAppsMap.end(); ++it ) |
280 | mExternalApps->insertItem( it.data(), it.key() ); | 285 | mExternalApps->insertItem( it.data(), it.key() ); |
281 | 286 | ||
282 | layout->addWidget( mExternalApps ); | 287 | layout->addWidget( mExternalApps ); |
283 | 288 | ||
284 | connect( mExternalApps, SIGNAL( activated( int ) ), | 289 | connect( mExternalApps, SIGNAL( activated( int ) ), |
285 | this, SLOT (externalapp_changed( int ) ) ); | 290 | this, SLOT (externalapp_changed( int ) ) ); |
286 | 291 | ||
287 | 292 | ||
288 | mExternalAppGroupBox = new QGroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); | 293 | mExternalAppGroupBox = new Q3GroupBox( 0, Qt::Vertical, i18n( "Used Mail Client" ), externalAppsPage ); |
289 | QGridLayout *boxLayout = new QGridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); | 294 | Q3GridLayout *boxLayout = new Q3GridLayout( mExternalAppGroupBox->layout(), 4, 2, -1, "gridlayout" ); |
290 | mExternalAppGroupBox->layout()->setMargin(4); | 295 | mExternalAppGroupBox->layout()->setMargin(4); |
291 | 296 | ||
292 | mClient = new QComboBox( mExternalAppGroupBox ); | 297 | mClient = new QComboBox( mExternalAppGroupBox ); |
293 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); | 298 | boxLayout->addMultiCellWidget( mClient, 0, 0, 0, 1 ); |
294 | 299 | ||
295 | connect( mClient, SIGNAL( activated( int ) ), | 300 | connect( mClient, SIGNAL( activated( int ) ), |
296 | this, SLOT (client_changed( int ) ) ); | 301 | this, SLOT (client_changed( int ) ) ); |
297 | 302 | ||
298 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); | 303 | QLabel* lab = new QLabel( i18n("Channel:"), mExternalAppGroupBox); |
299 | boxLayout->addWidget( lab, 1, 0 ); | 304 | boxLayout->addWidget( lab, 1, 0 ); |
300 | mChannel = new QLineEdit(mExternalAppGroupBox); | 305 | mChannel = new QLineEdit(mExternalAppGroupBox); |
301 | mChannel->setReadOnly(true); | 306 | mChannel->setReadOnly(true); |
302 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); | 307 | boxLayout->addMultiCellWidget( mChannel, 2 , 2, 0, 1 ); |
303 | 308 | ||
304 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); | 309 | lab = new QLabel( i18n("Message:"), mExternalAppGroupBox); |
305 | boxLayout->addWidget( lab, 3, 0 ); | 310 | boxLayout->addWidget( lab, 3, 0 ); |
306 | mMessage = new QLineEdit(mExternalAppGroupBox); | 311 | mMessage = new QLineEdit(mExternalAppGroupBox); |
307 | mMessage->setReadOnly(true); | 312 | mMessage->setReadOnly(true); |
308 | boxLayout->addWidget( mMessage , 4, 0); | 313 | boxLayout->addWidget( mMessage , 4, 0); |
309 | 314 | ||
310 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); | 315 | lab = new QLabel( i18n("Parameters:"), mExternalAppGroupBox); |
311 | boxLayout->addWidget( lab, 3, 1 ); | 316 | boxLayout->addWidget( lab, 3, 1 ); |
312 | mParameters = new QLineEdit(mExternalAppGroupBox); | 317 | mParameters = new QLineEdit(mExternalAppGroupBox); |
313 | mParameters->setReadOnly(true); | 318 | mParameters->setReadOnly(true); |
314 | boxLayout->addWidget( mParameters, 4, 1 ); | 319 | boxLayout->addWidget( mParameters, 4, 1 ); |
315 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); | 320 | lab = new QLabel( i18n("HINT: Delimiter=; Name=%1,Email=%2"), mExternalAppGroupBox); |
316 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); | 321 | boxLayout->addMultiCellWidget( lab, 5, 5, 0, 1 ); |
317 | 322 | ||
318 | 323 | ||
319 | if ( QApplication::desktop()->height() > 240 ) { | 324 | if ( QApplication::desktop()->height() > 240 ) { |
320 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); | 325 | lab = new QLabel( i18n("extra Message:"), mExternalAppGroupBox); |
321 | boxLayout->addWidget( lab, 6, 0 ); | 326 | boxLayout->addWidget( lab, 6, 0 ); |
322 | mMessage2 = new QLineEdit(mExternalAppGroupBox); | 327 | mMessage2 = new QLineEdit(mExternalAppGroupBox); |
323 | mMessage2->setReadOnly(true); | 328 | mMessage2->setReadOnly(true); |
324 | boxLayout->addWidget( mMessage2 , 7, 0); | 329 | boxLayout->addWidget( mMessage2 , 7, 0); |
325 | 330 | ||
326 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); | 331 | lab = new QLabel( i18n("extra Parameters:"), mExternalAppGroupBox); |
327 | boxLayout->addWidget( lab, 6, 1 ); | 332 | boxLayout->addWidget( lab, 6, 1 ); |
328 | mParameters2 = new QLineEdit(mExternalAppGroupBox); | 333 | mParameters2 = new QLineEdit(mExternalAppGroupBox); |
329 | mParameters2->setReadOnly(true); | 334 | mParameters2->setReadOnly(true); |
330 | boxLayout->addWidget( mParameters2, 7, 1 ); | 335 | boxLayout->addWidget( mParameters2, 7, 1 ); |
331 | 336 | ||
332 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); | 337 | lab = new QLabel( i18n("HINT: Emails=%1,Attachments=%2"), mExternalAppGroupBox); |
333 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); | 338 | boxLayout->addMultiCellWidget( lab, 8, 8, 0, 1 ); |
334 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 339 | connect( mMessage2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
335 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 340 | connect( mParameters2, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
336 | } else { | 341 | } else { |
337 | mMessage2 = 0; | 342 | mMessage2 = 0; |
338 | mParameters2 = 0; | 343 | mParameters2 = 0; |
339 | } | 344 | } |
340 | 345 | ||
341 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 346 | connect( mChannel, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
342 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 347 | connect( mMessage, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
343 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 348 | connect( mParameters, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
344 | 349 | ||
345 | 350 | ||
346 | layout->addWidget( mExternalAppGroupBox ); | 351 | layout->addWidget( mExternalAppGroupBox ); |
347 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); | 352 | tabWidget->addTab( externalAppsPage, i18n( "External Apps." ) ); |
348 | 353 | ||
349 | } | 354 | } |
350 | 355 | ||
351 | 356 | ||
352 | void KDEPIMConfigWidget::setupLocaleDateTab() | 357 | void KDEPIMConfigWidget::setupLocaleDateTab() |
353 | { | 358 | { |
354 | QWidget *topFrame = new QWidget( this ); | 359 | QWidget *topFrame = new QWidget( this ); |
355 | QGridLayout *topLayout = new QGridLayout( topFrame, 3, 2); | 360 | Q3GridLayout *topLayout = new Q3GridLayout( topFrame, 3, 2); |
356 | 361 | ||
357 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 362 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
358 | topLayout->setMargin(KDialog::marginHintSmall()); | 363 | topLayout->setMargin(KDialog::marginHintSmall()); |
359 | int iii = 0; | 364 | int iii = 0; |
360 | 365 | ||
361 | 366 | ||
362 | KPrefsWidRadios *syncPrefsGroup = | 367 | KPrefsWidRadios *syncPrefsGroup = |
363 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); | 368 | addWidRadios(i18n("Date Format:"),&(KPimGlobalPrefs::instance()->mPreferredDate),topFrame); |
364 | QString format; | 369 | QString format; |
365 | if ( QApplication::desktop()->width() < 480 ) | 370 | if ( QApplication::desktop()->width() < 480 ) |
366 | format = "(%d.%m.%Y)"; | 371 | format = "(%d.%m.%Y)"; |
367 | else | 372 | else |
368 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 373 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
369 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 374 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
370 | if ( QApplication::desktop()->width() < 480 ) | 375 | if ( QApplication::desktop()->width() < 480 ) |
371 | format = "(%m.%d.%Y)"; | 376 | format = "(%m.%d.%Y)"; |
372 | else | 377 | else |
373 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 378 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
374 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 379 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
375 | if ( QApplication::desktop()->width() < 480 ) | 380 | if ( QApplication::desktop()->width() < 480 ) |
376 | format = "(%Y-%m-%d)"; | 381 | format = "(%Y-%m-%d)"; |
377 | else | 382 | else |
378 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 383 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
379 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 384 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
380 | syncPrefsGroup->addRadio(i18n("User defined")); | 385 | syncPrefsGroup->addRadio(i18n("User defined")); |
381 | if ( QApplication::desktop()->width() < 480 ) { | 386 | if ( QApplication::desktop()->width() < 480 ) { |
382 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 387 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
383 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 388 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
384 | } | 389 | } |
385 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 390 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
386 | ++iii; | 391 | ++iii; |
387 | ++iii; | 392 | ++iii; |
388 | QLabel * lab; | 393 | QLabel * lab; |
389 | mUserDateFormatLong = new QLineEdit(topFrame); | 394 | mUserDateFormatLong = new QLineEdit(topFrame); |
390 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 395 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
391 | topLayout->addWidget(lab ,iii,0); | 396 | topLayout->addWidget(lab ,iii,0); |
392 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 397 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
393 | ++iii; | 398 | ++iii; |
394 | mUserDateFormatShort = new QLineEdit(topFrame); | 399 | mUserDateFormatShort = new QLineEdit(topFrame); |
395 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 400 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
396 | topLayout->addWidget(lab ,iii,0); | 401 | topLayout->addWidget(lab ,iii,0); |
397 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 402 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
398 | ++iii; | 403 | ++iii; |
399 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 404 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
400 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 405 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
401 | ++iii; | 406 | ++iii; |
402 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); | 407 | //qDebug(" QApplication::desktop()->height()xx %d ", QApplication::desktop()->height() ); |
403 | if ( QApplication::desktop()->height() > 240 ) { | 408 | if ( QApplication::desktop()->height() > 240 ) { |
404 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 409 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
405 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 410 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
406 | ++iii; | 411 | ++iii; |
407 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 412 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
408 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 413 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
409 | ++iii; | 414 | ++iii; |
410 | } | 415 | } |
411 | 416 | ||
412 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 417 | connect( mUserDateFormatLong, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
413 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); | 418 | connect( mUserDateFormatShort, SIGNAL( textChanged ( const QString & )), this, SLOT( textChanged ( const QString & )) ); |
414 | 419 | ||
415 | 420 | ||
416 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); | 421 | tabWidget->addTab( topFrame, i18n( "Date Format" ) ); |
417 | } | 422 | } |
418 | 423 | ||
419 | void KDEPIMConfigWidget::setupLocaleTab() | 424 | void KDEPIMConfigWidget::setupLocaleTab() |
420 | { | 425 | { |
421 | 426 | ||
422 | QWidget *topFrame = new QWidget( this ); | 427 | QWidget *topFrame = new QWidget( this ); |
423 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 428 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,4,2); |
424 | 429 | ||
425 | topLayout->setSpacing(KDialog::spacingHint()); | 430 | topLayout->setSpacing(KDialog::spacingHint()); |
426 | topLayout->setMargin(KDialog::marginHint()); | 431 | topLayout->setMargin(KDialog::marginHint()); |
427 | int iii = 0; | 432 | int iii = 0; |
428 | KPrefsWidRadios *syncPrefsGroup = | 433 | KPrefsWidRadios *syncPrefsGroup = |
429 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); | 434 | addWidRadios(i18n("Language:(needs restart)"),&(KPimGlobalPrefs::instance()->mPreferredLanguage),topFrame); |
430 | syncPrefsGroup->addRadio(i18n("English")); | 435 | syncPrefsGroup->addRadio(i18n("English")); |
431 | syncPrefsGroup->addRadio(i18n("German")); | 436 | syncPrefsGroup->addRadio(i18n("German")); |
432 | syncPrefsGroup->addRadio(i18n("French")); | 437 | syncPrefsGroup->addRadio(i18n("French")); |
433 | syncPrefsGroup->addRadio(i18n("Italian")); | 438 | syncPrefsGroup->addRadio(i18n("Italian")); |
434 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 439 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
435 | if ( QApplication::desktop()->width() < 300 ) { | 440 | if ( QApplication::desktop()->width() < 300 ) { |
436 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); | 441 | syncPrefsGroup->groupBox()->layout()->setMargin( 5 ); |
437 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); | 442 | syncPrefsGroup->groupBox()->layout()->setSpacing( 0 ); |
438 | } | 443 | } |
439 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); | 444 | topLayout->addMultiCellWidget( (QWidget*)syncPrefsGroup->groupBox(),iii,iii,0,1); |
440 | ++iii; | 445 | ++iii; |
441 | 446 | ||
442 | 447 | ||
443 | tabWidget->addTab( topFrame, i18n( "Language" ) ); | 448 | tabWidget->addTab( topFrame, i18n( "Language" ) ); |
444 | topFrame = new QWidget( this ); | 449 | topFrame = new QWidget( this ); |
445 | topLayout = new QGridLayout(topFrame,4,2); | 450 | topLayout = new Q3GridLayout(topFrame,4,2); |
446 | 451 | ||
447 | topLayout->setSpacing(KDialog::spacingHint()); | 452 | topLayout->setSpacing(KDialog::spacingHint()); |
448 | topLayout->setMargin(KDialog::marginHint()); | 453 | topLayout->setMargin(KDialog::marginHint()); |
449 | iii = 0; | 454 | iii = 0; |
450 | syncPrefsGroup = | 455 | syncPrefsGroup = |
451 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); | 456 | addWidRadios(i18n("Time Format(nr):"),&(KPimGlobalPrefs::instance()->mPreferredTime),topFrame); |
452 | if ( QApplication::desktop()->width() > 300 ) | 457 | if ( QApplication::desktop()->width() > 300 ) |
453 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 458 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
454 | syncPrefsGroup->addRadio(i18n("24:00")); | 459 | syncPrefsGroup->addRadio(i18n("24:00")); |
455 | syncPrefsGroup->addRadio(i18n("12:00am")); | 460 | syncPrefsGroup->addRadio(i18n("12:00am")); |
456 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); | 461 | syncPrefsGroup->groupBox()->setOrientation (Qt::Vertical); |
457 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 462 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
458 | ++iii; | 463 | ++iii; |
459 | 464 | ||
460 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), | 465 | KPrefsWidBool *sb = addWidBool(i18n("Week starts on Sunday"), |
461 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); | 466 | &(KPimGlobalPrefs::instance()->mWeekStartsOnSunday),topFrame); |
462 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 467 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
463 | ++iii; | 468 | ++iii; |
464 | 469 | ||
465 | 470 | ||
466 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); | 471 | tabWidget->addTab( topFrame, i18n( "Time Format" ) ); |
467 | 472 | ||
468 | } | 473 | } |
469 | 474 | ||
470 | 475 | ||
471 | void KDEPIMConfigWidget::setupTimeZoneTab() | 476 | void KDEPIMConfigWidget::setupTimeZoneTab() |
472 | { | 477 | { |
473 | QWidget *topFrame; | 478 | QWidget *topFrame; |
474 | QGridLayout *topLayout ; | 479 | Q3GridLayout *topLayout ; |
475 | 480 | ||
476 | 481 | ||
477 | 482 | ||
478 | 483 | ||
479 | 484 | ||
480 | 485 | ||
481 | topFrame = new QWidget( this ); | 486 | topFrame = new QWidget( this ); |
482 | topLayout = new QGridLayout( topFrame, 5, 2); | 487 | topLayout = new Q3GridLayout( topFrame, 5, 2); |
483 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 488 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
484 | topLayout->setMargin(KDialog::marginHintSmall()); | 489 | topLayout->setMargin(KDialog::marginHintSmall()); |
485 | 490 | ||
486 | QHBox *timeZoneBox = new QHBox( topFrame ); | 491 | Q3HBox *timeZoneBox = new Q3HBox( topFrame ); |
487 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | 492 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); |
488 | 493 | ||
489 | new QLabel( i18n("Timezone:"), timeZoneBox ); | 494 | new QLabel( i18n("Timezone:"), timeZoneBox ); |
490 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | 495 | mTimeZoneCombo = new QComboBox( timeZoneBox ); |
491 | if ( QApplication::desktop()->width() < 300 ) { | 496 | if ( QApplication::desktop()->width() < 300 ) { |
492 | mTimeZoneCombo->setMaximumWidth(150); | 497 | mTimeZoneCombo->setMaximumWidth(150); |
493 | } | 498 | } |
494 | 499 | ||
495 | QStringList list; | 500 | QStringList list; |
496 | list = KGlobal::locale()->timeZoneList(); | 501 | list = KGlobal::locale()->timeZoneList(); |
497 | mTimeZoneCombo->insertStringList(list); | 502 | mTimeZoneCombo->insertStringList(list); |
498 | 503 | ||
499 | // find the currently set time zone and select it | 504 | // find the currently set time zone and select it |
500 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; | 505 | QString sCurrentlySet = KPimGlobalPrefs::instance()->mTimeZoneId; |
501 | int nCurrentlySet = 11; | 506 | int nCurrentlySet = 11; |
502 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | 507 | for (int i = 0; i < mTimeZoneCombo->count(); i++) |
503 | { | 508 | { |
504 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | 509 | if (mTimeZoneCombo->text(i) == sCurrentlySet) |
505 | { | 510 | { |
506 | nCurrentlySet = i; | 511 | nCurrentlySet = i; |
507 | break; | 512 | break; |
508 | } | 513 | } |
509 | } | 514 | } |
510 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | 515 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); |
511 | int iii = 1; | 516 | int iii = 1; |
512 | KPrefsWidBool *sb = | 517 | KPrefsWidBool *sb = |
513 | addWidBool(i18n("Add 30 min to selected Timezone"), | 518 | addWidBool(i18n("Add 30 min to selected Timezone"), |
514 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); | 519 | &(KPimGlobalPrefs::instance()->mTimeZoneAdd30min),topFrame); |
515 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 520 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
516 | ++iii; | 521 | ++iii; |
517 | sb = | 522 | sb = |
518 | addWidBool(i18n("Timezone has daylight saving"), | 523 | addWidBool(i18n("Timezone has daylight saving"), |
519 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); | 524 | &(KPimGlobalPrefs::instance()->mUseDaylightsaving),topFrame); |
520 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); | 525 | topLayout->addMultiCellWidget((QWidget*)sb->checkBox(), iii,iii,0,1); |
521 | ++iii; | 526 | ++iii; |
522 | QLabel* lab; | 527 | QLabel* lab; |
523 | 528 | ||
524 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | 529 | lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); |
525 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 530 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
526 | ++iii; | 531 | ++iii; |
527 | 532 | ||
528 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | 533 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); |
529 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | 534 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); |
530 | ++iii; | 535 | ++iii; |
531 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | 536 | lab = new QLabel( i18n("Daylight start:"), topFrame ); |
532 | topLayout->addWidget(lab, iii,0); | 537 | topLayout->addWidget(lab, iii,0); |
533 | mStartDateSavingEdit = new KDateEdit(topFrame); | 538 | mStartDateSavingEdit = new KDateEdit(topFrame); |
534 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | 539 | topLayout->addWidget(mStartDateSavingEdit, iii,1); |
535 | ++iii; | 540 | ++iii; |
536 | 541 | ||
537 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | 542 | lab = new QLabel( i18n("Daylight end:"), topFrame ); |
538 | topLayout->addWidget(lab, iii,0); | 543 | topLayout->addWidget(lab, iii,0); |
539 | mEndDateSavingEdit = new KDateEdit(topFrame); | 544 | mEndDateSavingEdit = new KDateEdit(topFrame); |
540 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | 545 | topLayout->addWidget(mEndDateSavingEdit, iii,1); |
541 | ++iii; | 546 | ++iii; |
542 | QDate current ( 2001, 1,1); | 547 | QDate current ( 2001, 1,1); |
543 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); | 548 | mStartDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingStart-1)); |
544 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); | 549 | mEndDateSavingEdit->setDate(current.addDays(KPimGlobalPrefs::instance()->mDaylightsavingEnd-1)); |
545 | 550 | ||
546 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 551 | connect( mStartDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
547 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); | 552 | connect( mEndDateSavingEdit, SIGNAL( dateChanged(QDate)), this, SLOT( modified()) ); |
548 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); | 553 | connect( mTimeZoneCombo, SIGNAL( activated( int ) ), this, SLOT (modified() ) ); |
549 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); | 554 | tabWidget->addTab( topFrame, i18n( "Time Zone" ) ); |
550 | 555 | ||
551 | 556 | ||
552 | topFrame = new QWidget( this ); | 557 | topFrame = new QWidget( this ); |
553 | topLayout = new QGridLayout( topFrame, 3, 2); | 558 | topLayout = new Q3GridLayout( topFrame, 3, 2); |
554 | topLayout->setSpacing(KDialog::spacingHintSmall()); | 559 | topLayout->setSpacing(KDialog::spacingHintSmall()); |
555 | topLayout->setMargin(KDialog::marginHintSmall()); | 560 | topLayout->setMargin(KDialog::marginHintSmall()); |
556 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); | 561 | tabWidget->addTab( topFrame, i18n( "Fonts" ) ); |
557 | 562 | ||
558 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); | 563 | QLabel* labb = new QLabel( i18n("Global application font for all apps:"), topFrame ); |
559 | topLayout->addMultiCellWidget(labb,0,0,0,2); | 564 | topLayout->addMultiCellWidget(labb,0,0,0,2); |
560 | int i = 1; | 565 | int i = 1; |
561 | KPrefsWidFont *timeLabelsFont = | 566 | KPrefsWidFont *timeLabelsFont = |
562 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), | 567 | addWidFont(i18n("Kx/Pi"),i18n("Application Font"), |
563 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); | 568 | &(KPimGlobalPrefs::instance()->mApplicationFont),topFrame); |
564 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 569 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
565 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 570 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
566 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 571 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
567 | } | 572 | } |
568 | 573 | ||
569 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) | 574 | void KDEPIMConfigWidget::externalapp_changed( int newApp ) |
570 | { | 575 | { |
571 | // first store the current data | 576 | // first store the current data |
572 | saveEditFieldSettings(); | 577 | saveEditFieldSettings(); |
573 | 578 | ||
574 | // set mCurrentApp | 579 | // set mCurrentApp |
575 | mCurrentApp = (ExternalAppHandler::Types)newApp; | 580 | mCurrentApp = (ExternalAppHandler::Types)newApp; |
576 | 581 | ||
577 | // set mCurrentClient | 582 | // set mCurrentClient |
578 | switch(mCurrentApp) | 583 | switch(mCurrentApp) |
579 | { | 584 | { |
580 | case(ExternalAppHandler::EMAIL): | 585 | case(ExternalAppHandler::EMAIL): |
581 | mCurrentClient = mEmailClient; | 586 | mCurrentClient = mEmailClient; |
582 | break; | 587 | break; |
583 | case(ExternalAppHandler::PHONE): | 588 | case(ExternalAppHandler::PHONE): |
584 | mCurrentClient = mPhoneClient; | 589 | mCurrentClient = mPhoneClient; |
585 | break; | 590 | break; |
586 | case(ExternalAppHandler::SMS): | 591 | case(ExternalAppHandler::SMS): |
587 | mCurrentClient = mSMSClient; | 592 | mCurrentClient = mSMSClient; |
588 | break; | 593 | break; |
589 | case(ExternalAppHandler::FAX): | 594 | case(ExternalAppHandler::FAX): |
590 | mCurrentClient = mFaxClient; | 595 | mCurrentClient = mFaxClient; |
591 | break; | 596 | break; |
592 | case(ExternalAppHandler::PAGER): | 597 | case(ExternalAppHandler::PAGER): |
593 | mCurrentClient = mPagerClient; | 598 | mCurrentClient = mPagerClient; |
594 | break; | 599 | break; |
595 | case(ExternalAppHandler::SIP): | 600 | case(ExternalAppHandler::SIP): |
596 | mCurrentClient = mSipClient; | 601 | mCurrentClient = mSipClient; |
597 | break; | 602 | break; |
598 | default: | 603 | default: |
599 | return; | 604 | return; |
600 | } | 605 | } |
601 | 606 | ||
602 | // and at last update the widgets | 607 | // and at last update the widgets |
603 | updateClientWidgets(); | 608 | updateClientWidgets(); |
604 | } | 609 | } |
605 | 610 | ||
606 | 611 | ||
607 | 612 | ||
608 | void KDEPIMConfigWidget::client_changed( int newClient ) | 613 | void KDEPIMConfigWidget::client_changed( int newClient ) |
609 | { | 614 | { |
610 | if (newClient == mCurrentClient) | 615 | if (newClient == mCurrentClient) |
611 | return; | 616 | return; |
612 | 617 | ||
613 | // first store the current data | 618 | // first store the current data |
614 | saveEditFieldSettings(); | 619 | saveEditFieldSettings(); |
615 | 620 | ||
616 | 621 | ||
617 | //then reset the clientvariable | 622 | //then reset the clientvariable |
@@ -650,129 +655,129 @@ void KDEPIMConfigWidget::saveEditFieldSettings() | |||
650 | return; | 655 | return; |
651 | } | 656 | } |
652 | 657 | ||
653 | //store the current data back to the apropriate membervariables if we had set it to "other" | 658 | //store the current data back to the apropriate membervariables if we had set it to "other" |
654 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 659 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
655 | { | 660 | { |
656 | mEmailOtherChannel = mChannel->text(); | 661 | mEmailOtherChannel = mChannel->text(); |
657 | mEmailOtherMessage = mMessage->text(); | 662 | mEmailOtherMessage = mMessage->text(); |
658 | mEmailOtherMessageParameters = mParameters->text(); | 663 | mEmailOtherMessageParameters = mParameters->text(); |
659 | if ( mMessage2 ) | 664 | if ( mMessage2 ) |
660 | mEmailOtherMessage2 = mMessage2->text(); | 665 | mEmailOtherMessage2 = mMessage2->text(); |
661 | if ( mParameters2 ) | 666 | if ( mParameters2 ) |
662 | mEmailOtherMessageParameters2 = mParameters2->text(); | 667 | mEmailOtherMessageParameters2 = mParameters2->text(); |
663 | } | 668 | } |
664 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 669 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
665 | { | 670 | { |
666 | mPhoneOtherChannel = mChannel->text(); | 671 | mPhoneOtherChannel = mChannel->text(); |
667 | mPhoneOtherMessage = mMessage->text(); | 672 | mPhoneOtherMessage = mMessage->text(); |
668 | mPhoneOtherMessageParameters = mParameters->text(); | 673 | mPhoneOtherMessageParameters = mParameters->text(); |
669 | } | 674 | } |
670 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 675 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
671 | { | 676 | { |
672 | mSMSOtherChannel = mChannel->text(); | 677 | mSMSOtherChannel = mChannel->text(); |
673 | mSMSOtherMessage = mMessage->text(); | 678 | mSMSOtherMessage = mMessage->text(); |
674 | mSMSOtherMessageParameters = mParameters->text(); | 679 | mSMSOtherMessageParameters = mParameters->text(); |
675 | } | 680 | } |
676 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 681 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
677 | { | 682 | { |
678 | mFaxOtherChannel = mChannel->text(); | 683 | mFaxOtherChannel = mChannel->text(); |
679 | mFaxOtherMessage = mMessage->text(); | 684 | mFaxOtherMessage = mMessage->text(); |
680 | mFaxOtherMessageParameters = mParameters->text(); | 685 | mFaxOtherMessageParameters = mParameters->text(); |
681 | } | 686 | } |
682 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 687 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
683 | { | 688 | { |
684 | mPagerOtherChannel = mChannel->text(); | 689 | mPagerOtherChannel = mChannel->text(); |
685 | mPagerOtherMessage = mMessage->text(); | 690 | mPagerOtherMessage = mMessage->text(); |
686 | mPagerOtherMessageParameters = mParameters->text(); | 691 | mPagerOtherMessageParameters = mParameters->text(); |
687 | } | 692 | } |
688 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 693 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
689 | { | 694 | { |
690 | mSipOtherChannel = mChannel->text(); | 695 | mSipOtherChannel = mChannel->text(); |
691 | mSipOtherMessage = mMessage->text(); | 696 | mSipOtherMessage = mMessage->text(); |
692 | mSipOtherMessageParameters = mParameters->text(); | 697 | mSipOtherMessageParameters = mParameters->text(); |
693 | } | 698 | } |
694 | 699 | ||
695 | 700 | ||
696 | } | 701 | } |
697 | 702 | ||
698 | void KDEPIMConfigWidget::updateClientWidgets() | 703 | void KDEPIMConfigWidget::updateClientWidgets() |
699 | { | 704 | { |
700 | bool blocked = signalsBlocked(); | 705 | bool blocked = signalsBlocked(); |
701 | blockSignals( true ); | 706 | blockSignals( true ); |
702 | 707 | ||
703 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display | 708 | // at this point we assume, that mCurrentApp and mCurrentClient are set to the values that we want to display |
704 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); | 709 | QMap<ExternalAppHandler::Types, QString>::Iterator it = mExternalAppsMap.find ( mCurrentApp ); |
705 | if (it == mExternalAppsMap.end()) | 710 | if (it == mExternalAppsMap.end()) |
706 | return; | 711 | return; |
707 | 712 | ||
708 | // update group box | 713 | // update group box |
709 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); | 714 | mExternalAppGroupBox->setTitle(i18n( "Used %1 Client" ).arg(it.data())); |
710 | 715 | ||
711 | //update the entries in the client combobox | 716 | //update the entries in the client combobox |
712 | mClient->clear(); | 717 | mClient->clear(); |
713 | 718 | ||
714 | QList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); | 719 | Q3PtrList<DefaultAppItem> items = ExternalAppHandler::instance()->getAvailableDefaultItems(mCurrentApp); |
715 | DefaultAppItem* dai; | 720 | DefaultAppItem* dai; |
716 | for ( dai=items.first(); dai != 0; dai=items.next() ) | 721 | for ( dai=items.first(); dai != 0; dai=items.next() ) |
717 | { | 722 | { |
718 | mClient->insertItem( i18n(dai->_label), dai->_id ); | 723 | mClient->insertItem( i18n(dai->_label), dai->_id ); |
719 | 724 | ||
720 | if (dai->_id == mCurrentClient) | 725 | if (dai->_id == mCurrentClient) |
721 | { | 726 | { |
722 | //restore the edit fields with the data of the local membervariables if we had set it to "other". | 727 | //restore the edit fields with the data of the local membervariables if we had set it to "other". |
723 | //Otherwise take the default data from externalapphandler. | 728 | //Otherwise take the default data from externalapphandler. |
724 | mChannel->setText(dai->_channel); | 729 | mChannel->setText(dai->_channel); |
725 | mMessage->setText(dai->_message); | 730 | mMessage->setText(dai->_message); |
726 | mParameters->setText(dai->_parameters); | 731 | mParameters->setText(dai->_parameters); |
727 | if ( mMessage2 ) | 732 | if ( mMessage2 ) |
728 | mMessage2->setText(dai->_message2); | 733 | mMessage2->setText(dai->_message2); |
729 | if ( mParameters2 ) | 734 | if ( mParameters2 ) |
730 | mParameters2->setText(dai->_parameters2); | 735 | mParameters2->setText(dai->_parameters2); |
731 | 736 | ||
732 | 737 | ||
733 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) | 738 | if ((mCurrentApp == ExternalAppHandler::EMAIL) && (mCurrentClient == KPimGlobalPrefs::OTHER_EMC)) |
734 | { | 739 | { |
735 | mChannel->setText(mEmailOtherChannel); | 740 | mChannel->setText(mEmailOtherChannel); |
736 | mMessage->setText(mEmailOtherMessage); | 741 | mMessage->setText(mEmailOtherMessage); |
737 | mParameters->setText(mEmailOtherMessageParameters); | 742 | mParameters->setText(mEmailOtherMessageParameters); |
738 | if ( mMessage2 ) | 743 | if ( mMessage2 ) |
739 | mMessage2->setText(mEmailOtherMessage2); | 744 | mMessage2->setText(mEmailOtherMessage2); |
740 | if ( mParameters2 ) | 745 | if ( mParameters2 ) |
741 | mParameters2->setText(mEmailOtherMessageParameters2); | 746 | mParameters2->setText(mEmailOtherMessageParameters2); |
742 | } | 747 | } |
743 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) | 748 | else if ((mCurrentApp == ExternalAppHandler::PHONE) && (mCurrentClient == KPimGlobalPrefs::OTHER_PHC)) |
744 | { | 749 | { |
745 | mChannel->setText(mPhoneOtherChannel); | 750 | mChannel->setText(mPhoneOtherChannel); |
746 | mMessage->setText(mPhoneOtherMessage); | 751 | mMessage->setText(mPhoneOtherMessage); |
747 | mParameters->setText(mPhoneOtherMessageParameters); | 752 | mParameters->setText(mPhoneOtherMessageParameters); |
748 | } | 753 | } |
749 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) | 754 | else if ((mCurrentApp == ExternalAppHandler::SMS) && (mCurrentClient == KPimGlobalPrefs::OTHER_SMC)) |
750 | { | 755 | { |
751 | mChannel->setText(mSMSOtherChannel); | 756 | mChannel->setText(mSMSOtherChannel); |
752 | mMessage->setText(mSMSOtherMessage); | 757 | mMessage->setText(mSMSOtherMessage); |
753 | mParameters->setText(mSMSOtherMessageParameters); | 758 | mParameters->setText(mSMSOtherMessageParameters); |
754 | } | 759 | } |
755 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) | 760 | else if ((mCurrentApp == ExternalAppHandler::FAX) && (mCurrentClient == KPimGlobalPrefs::OTHER_FAC)) |
756 | { | 761 | { |
757 | mChannel->setText(mFaxOtherChannel); | 762 | mChannel->setText(mFaxOtherChannel); |
758 | mMessage->setText(mFaxOtherMessage); | 763 | mMessage->setText(mFaxOtherMessage); |
759 | mParameters->setText(mFaxOtherMessageParameters); | 764 | mParameters->setText(mFaxOtherMessageParameters); |
760 | } | 765 | } |
761 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) | 766 | else if ((mCurrentApp == ExternalAppHandler::PAGER) && (mCurrentClient == KPimGlobalPrefs::OTHER_PAC)) |
762 | { | 767 | { |
763 | mChannel->setText(mPagerOtherChannel); | 768 | mChannel->setText(mPagerOtherChannel); |
764 | mMessage->setText(mPagerOtherMessage); | 769 | mMessage->setText(mPagerOtherMessage); |
765 | mParameters->setText(mPagerOtherMessageParameters); | 770 | mParameters->setText(mPagerOtherMessageParameters); |
766 | } | 771 | } |
767 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) | 772 | else if ((mCurrentApp == ExternalAppHandler::SIP) && (mCurrentClient == KPimGlobalPrefs::OTHER_SIC)) |
768 | { | 773 | { |
769 | mChannel->setText(mSipOtherChannel); | 774 | mChannel->setText(mSipOtherChannel); |
770 | mMessage->setText(mSipOtherMessage); | 775 | mMessage->setText(mSipOtherMessage); |
771 | mParameters->setText(mSipOtherMessageParameters); | 776 | mParameters->setText(mSipOtherMessageParameters); |
772 | } | 777 | } |
773 | } | 778 | } |
774 | 779 | ||
775 | } | 780 | } |
776 | 781 | ||
777 | bool readonly; | 782 | bool readonly; |
778 | bool enabled; | 783 | bool enabled; |
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.h b/libkdepim/kcmconfigs/kdepimconfigwidget.h index 824ef79..d693015 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.h +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.h | |||
@@ -1,163 +1,165 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDEPim/Pi. | 2 | This file is part of KDEPim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef KDEPIMCONFIGWIDGET_H | 31 | #ifndef KDEPIMCONFIGWIDGET_H |
32 | #define KDEPIMCONFIGWIDGET_H | 32 | #define KDEPIMCONFIGWIDGET_H |
33 | 33 | ||
34 | #include <kprefswidget.h> | 34 | #include <kprefswidget.h> |
35 | #include <kio/kfile/kurlrequester.h> | 35 | #include <kio/kfile/kurlrequester.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | //Added by qt3to4: | ||
38 | #include <QLabel> | ||
37 | 39 | ||
38 | #include "externalapphandler.h" | 40 | #include "externalapphandler.h" |
39 | 41 | ||
40 | 42 | ||
41 | class QComboBox; | 43 | class QComboBox; |
42 | class QLineEdit; | 44 | class QLineEdit; |
43 | class KPimGlobalPrefs; | 45 | class KPimGlobalPrefs; |
44 | class QGroupBox; | 46 | class Q3GroupBox; |
45 | class QTabWidget; | 47 | class QTabWidget; |
46 | class KDateEdit; | 48 | class KDateEdit; |
47 | 49 | ||
48 | class KDEPIMConfigWidget : public KPrefsWidget | 50 | class KDEPIMConfigWidget : public KPrefsWidget |
49 | { | 51 | { |
50 | Q_OBJECT | 52 | Q_OBJECT |
51 | 53 | ||
52 | public: | 54 | public: |
53 | KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); | 55 | KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name = 0 ); |
54 | 56 | ||
55 | public slots: | 57 | public slots: |
56 | void textChanged( const QString& text ); | 58 | void textChanged( const QString& text ); |
57 | void showTimeZoneTab(); | 59 | void showTimeZoneTab(); |
58 | 60 | ||
59 | protected: | 61 | protected: |
60 | /** Implement this to read custom configuration widgets. */ | 62 | /** Implement this to read custom configuration widgets. */ |
61 | virtual void usrReadConfig(); | 63 | virtual void usrReadConfig(); |
62 | /** Implement this to write custom configuration widgets. */ | 64 | /** Implement this to write custom configuration widgets. */ |
63 | virtual void usrWriteConfig(); | 65 | virtual void usrWriteConfig(); |
64 | 66 | ||
65 | 67 | ||
66 | private slots: | 68 | private slots: |
67 | // void configureExtension(); | 69 | // void configureExtension(); |
68 | // void selectionChanged( QListViewItem* ); | 70 | // void selectionChanged( QListViewItem* ); |
69 | // void itemClicked( QListViewItem* ); | 71 | // void itemClicked( QListViewItem* ); |
70 | void client_changed( int newClient ); | 72 | void client_changed( int newClient ); |
71 | void externalapp_changed( int newApp ); | 73 | void externalapp_changed( int newApp ); |
72 | void saveStoreSettings(); | 74 | void saveStoreSettings(); |
73 | void setStandardStore(); | 75 | void setStandardStore(); |
74 | void setLocalStore(); | 76 | void setLocalStore(); |
75 | 77 | ||
76 | private: | 78 | private: |
77 | void setupExternalAppTab(); | 79 | void setupExternalAppTab(); |
78 | void setupLocaleDateTab(); | 80 | void setupLocaleDateTab(); |
79 | void setupLocaleTab(); | 81 | void setupLocaleTab(); |
80 | void setupTimeZoneTab(); | 82 | void setupTimeZoneTab(); |
81 | void setupStoreTab(); | 83 | void setupStoreTab(); |
82 | void setupBackupTab(); | 84 | void setupBackupTab(); |
83 | KURLRequester* mStoreUrl; | 85 | KURLRequester* mStoreUrl; |
84 | 86 | ||
85 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 87 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
86 | 88 | ||
87 | 89 | ||
88 | void saveEditFieldSettings(); | 90 | void saveEditFieldSettings(); |
89 | void updateClientWidgets(); | 91 | void updateClientWidgets(); |
90 | 92 | ||
91 | QTabWidget *tabWidget; | 93 | QTabWidget *tabWidget; |
92 | 94 | ||
93 | 95 | ||
94 | QLineEdit* mUserDateFormatShort; | 96 | QLineEdit* mUserDateFormatShort; |
95 | QLineEdit* mUserDateFormatLong; | 97 | QLineEdit* mUserDateFormatLong; |
96 | QComboBox* mTimeZoneCombo; | 98 | QComboBox* mTimeZoneCombo; |
97 | KDateEdit* mStartDateSavingEdit; | 99 | KDateEdit* mStartDateSavingEdit; |
98 | KDateEdit* mEndDateSavingEdit; | 100 | KDateEdit* mEndDateSavingEdit; |
99 | 101 | ||
100 | // void restoreExtensionSettings(); | 102 | // void restoreExtensionSettings(); |
101 | // void saveExtensionSettings(); | 103 | // void saveExtensionSettings(); |
102 | 104 | ||
103 | // KListView *mExtensionView; | 105 | // KListView *mExtensionView; |
104 | 106 | ||
105 | // QCheckBox *mNameParsing; | 107 | // QCheckBox *mNameParsing; |
106 | // QCheckBox *mViewsSingleClickBox; | 108 | // QCheckBox *mViewsSingleClickBox; |
107 | // QPushButton *mConfigureButton; | 109 | // QPushButton *mConfigureButton; |
108 | QComboBox* mExternalApps; | 110 | QComboBox* mExternalApps; |
109 | QGroupBox* mExternalAppGroupBox; | 111 | Q3GroupBox* mExternalAppGroupBox; |
110 | 112 | ||
111 | 113 | ||
112 | QComboBox* mClient; | 114 | QComboBox* mClient; |
113 | QLineEdit* mChannel; | 115 | QLineEdit* mChannel; |
114 | QLineEdit* mMessage; | 116 | QLineEdit* mMessage; |
115 | QLineEdit* mParameters; | 117 | QLineEdit* mParameters; |
116 | QLineEdit* mMessage2; | 118 | QLineEdit* mMessage2; |
117 | QLineEdit* mParameters2; | 119 | QLineEdit* mParameters2; |
118 | 120 | ||
119 | ExternalAppHandler::Types mCurrentApp; | 121 | ExternalAppHandler::Types mCurrentApp; |
120 | int mCurrentClient; | 122 | int mCurrentClient; |
121 | 123 | ||
122 | 124 | ||
123 | int mEmailClient; | 125 | int mEmailClient; |
124 | QString mEmailOtherChannel; | 126 | QString mEmailOtherChannel; |
125 | QString mEmailOtherMessage; | 127 | QString mEmailOtherMessage; |
126 | QString mEmailOtherMessageParameters; | 128 | QString mEmailOtherMessageParameters; |
127 | QString mEmailOtherMessage2; | 129 | QString mEmailOtherMessage2; |
128 | QString mEmailOtherMessageParameters2; | 130 | QString mEmailOtherMessageParameters2; |
129 | 131 | ||
130 | int mPhoneClient; | 132 | int mPhoneClient; |
131 | QString mPhoneOtherChannel; | 133 | QString mPhoneOtherChannel; |
132 | QString mPhoneOtherMessage; | 134 | QString mPhoneOtherMessage; |
133 | QString mPhoneOtherMessageParameters; | 135 | QString mPhoneOtherMessageParameters; |
134 | 136 | ||
135 | int mFaxClient; | 137 | int mFaxClient; |
136 | QString mFaxOtherChannel; | 138 | QString mFaxOtherChannel; |
137 | QString mFaxOtherMessage; | 139 | QString mFaxOtherMessage; |
138 | QString mFaxOtherMessageParameters; | 140 | QString mFaxOtherMessageParameters; |
139 | 141 | ||
140 | int mSMSClient; | 142 | int mSMSClient; |
141 | QString mSMSOtherChannel; | 143 | QString mSMSOtherChannel; |
142 | QString mSMSOtherMessage; | 144 | QString mSMSOtherMessage; |
143 | QString mSMSOtherMessageParameters; | 145 | QString mSMSOtherMessageParameters; |
144 | 146 | ||
145 | int mPagerClient; | 147 | int mPagerClient; |
146 | QString mPagerOtherChannel; | 148 | QString mPagerOtherChannel; |
147 | QString mPagerOtherMessage; | 149 | QString mPagerOtherMessage; |
148 | QString mPagerOtherMessageParameters; | 150 | QString mPagerOtherMessageParameters; |
149 | 151 | ||
150 | int mSipClient; | 152 | int mSipClient; |
151 | QString mSipOtherChannel; | 153 | QString mSipOtherChannel; |
152 | QString mSipOtherMessage; | 154 | QString mSipOtherMessage; |
153 | QString mSipOtherMessageParameters; | 155 | QString mSipOtherMessageParameters; |
154 | 156 | ||
155 | QLabel* mDataStoragePath; | 157 | QLabel* mDataStoragePath; |
156 | KURLRequester* mBackupUrl; | 158 | KURLRequester* mBackupUrl; |
157 | QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ; | 159 | QSpinBox* mBackupDayCountSpin, *mBackupNumbersSpin ; |
158 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; | 160 | QMap<ExternalAppHandler::Types, QString> mExternalAppsMap; |
159 | 161 | ||
160 | // AddresseeWidget *mAddresseeWidget; | 162 | // AddresseeWidget *mAddresseeWidget; |
161 | }; | 163 | }; |
162 | 164 | ||
163 | #endif | 165 | #endif |
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index bf38479..28c88d4 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -1,153 +1,157 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qapplication.h> | 25 | #include <qapplication.h> |
26 | #include <qevent.h> | 26 | #include <qevent.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3Frame> | ||
32 | #include <QKeyEvent> | ||
30 | 33 | ||
31 | #include <kdatepicker.h> | 34 | #include <kdatepicker.h> |
32 | #include <kdebug.h> | 35 | #include <kdebug.h> |
33 | #include <kglobal.h> | 36 | #include <kglobal.h> |
34 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
35 | #include <klocale.h> | 38 | #include <klocale.h> |
36 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
37 | #include <knotifyclient.h> | 40 | #include <knotifyclient.h> |
38 | #include <qpalette.h> | 41 | #include <qpalette.h> |
42 | #include <QDesktopWidget> | ||
39 | 43 | ||
40 | #include "kdateedit.h" | 44 | #include "kdateedit.h" |
41 | //#include "kdateedit.moc" | 45 | //#include "kdateedit.moc" |
42 | 46 | ||
43 | KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) | 47 | KDateEdit::KDateEdit(QWidget *parent, const char *name, bool withoutDP ) |
44 | : QHBox(parent, name) | 48 | : Q3HBox(parent, name) |
45 | { | 49 | { |
46 | dateFormShort = true; | 50 | dateFormShort = true; |
47 | withoutDp = withoutDP; | 51 | withoutDp = withoutDP; |
48 | mDateEdit = new QLineEdit(this); | 52 | mDateEdit = new QLineEdit(this); |
49 | mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort)); | 53 | mDateEdit->setText(KGlobal::locale()->formatDate(QDate::currentDate(),dateFormShort)); |
50 | setFocusProxy(mDateEdit); | 54 | setFocusProxy(mDateEdit); |
51 | mDateEdit->installEventFilter(this); | 55 | mDateEdit->installEventFilter(this); |
52 | 56 | ||
53 | // Highlight Background and Textcolor | 57 | // Highlight Background and Textcolor |
54 | QPalette palette = QWidget::palette(); | 58 | QPalette palette = QWidget::palette(); |
55 | unsigned char red, green, blue; | 59 | unsigned char red, green, blue; |
56 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; | 60 | red = palette.color( QPalette::Normal , QColorGroup::Background ).red() - 10; |
57 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; | 61 | green = palette.color( QPalette::Normal , QColorGroup::Background ).green() - 10; |
58 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; | 62 | blue = palette.color( QPalette::Normal , QColorGroup::Background ).blue() - 10; |
59 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); | 63 | palette.setColor( QColorGroup::Highlight, QColor(red,green,blue) ); |
60 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); | 64 | palette.setColor( QColorGroup::HighlightedText, palette.color( QPalette::Normal , QColorGroup::Foreground ) ); |
61 | mDateEdit->setPalette( palette ); | 65 | mDateEdit->setPalette( palette ); |
62 | 66 | ||
63 | if ( withoutDP ) { | 67 | if ( withoutDP ) { |
64 | mDateFrame = 0; | 68 | mDateFrame = 0; |
65 | mDateButton = 0; | 69 | mDateButton = 0; |
66 | mDatePicker = 0; | 70 | mDatePicker = 0; |
67 | } else { | 71 | } else { |
68 | QPixmap pixmap = SmallIcon("smallcal"); | 72 | QPixmap pixmap = SmallIcon("smallcal"); |
69 | mDateButton = new QPushButton(this); | 73 | mDateButton = new QPushButton(this); |
70 | mDateButton->setPixmap(pixmap); | 74 | mDateButton->setPixmap(pixmap); |
71 | QPixmap pixmap2 = SmallIcon("today_small"); | 75 | QPixmap pixmap2 = SmallIcon("today_small"); |
72 | QPushButton* nowButton = new QPushButton(this); | 76 | QPushButton* nowButton = new QPushButton(this); |
73 | nowButton->setPixmap(pixmap2); | 77 | nowButton->setPixmap(pixmap2); |
74 | 78 | ||
75 | mDateFrame = new QVBox(0,0,WType_Popup); | 79 | mDateFrame = new Q3VBox(0,0,Qt::WType_Popup); |
76 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 80 | // mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
77 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 81 | mDateFrame->setFrameStyle( Q3Frame::WinPanel |Q3Frame::Raised ); |
78 | mDateFrame->setLineWidth(3); | 82 | mDateFrame->setLineWidth(3); |
79 | mDateFrame->hide(); | 83 | mDateFrame->hide(); |
80 | 84 | ||
81 | mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); | 85 | mDatePicker = new KDatePicker(mDateFrame,QDate::currentDate()); |
82 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); | 86 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SLOT(setDate(QDate))); |
83 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); | 87 | connect(mDatePicker,SIGNAL(dateEntered(QDate)),SIGNAL(dateChanged(QDate))); |
84 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); | 88 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(setDate(QDate))); |
85 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); | 89 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SIGNAL(dateChanged(QDate))); |
86 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); | 90 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),mDateFrame,SLOT(hide())); |
87 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); | 91 | connect(mDateButton,SIGNAL(clicked()),SLOT(toggleDatePicker())); |
88 | connect(nowButton,SIGNAL(clicked()),SLOT(goToNow())); | 92 | connect(nowButton,SIGNAL(clicked()),SLOT(goToNow())); |
89 | mDateButton->setFocusPolicy( QWidget::NoFocus ); | 93 | mDateButton->setFocusPolicy( Qt::NoFocus ); |
90 | mDateButton->setAutoDefault( false ); | 94 | mDateButton->setAutoDefault( false ); |
91 | //mDateFrame->resize( 400, 300 ); | 95 | //mDateFrame->resize( 400, 300 ); |
92 | 96 | ||
93 | } | 97 | } |
94 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); | 98 | connect(mDateEdit,SIGNAL(returnPressed()),SLOT(lineEnterPressed())); |
95 | connect(mDateEdit,SIGNAL(textChanged(const QString &)), | 99 | connect(mDateEdit,SIGNAL(textChanged(const QString &)), |
96 | SLOT(textChanged(const QString &))); | 100 | SLOT(textChanged(const QString &))); |
97 | 101 | ||
98 | // Create the keyword list. This will be used to match against when the user | 102 | // Create the keyword list. This will be used to match against when the user |
99 | // enters information. | 103 | // enters information. |
100 | mKeywordMap[i18n("tomorrow")] = 1; | 104 | mKeywordMap[i18n("tomorrow")] = 1; |
101 | mKeywordMap[i18n("today")] = 0; | 105 | mKeywordMap[i18n("today")] = 0; |
102 | mKeywordMap[i18n("yesterday")] = -1; | 106 | mKeywordMap[i18n("yesterday")] = -1; |
103 | 107 | ||
104 | /* | 108 | /* |
105 | * This loop uses some math tricks to figure out the offset in days | 109 | * This loop uses some math tricks to figure out the offset in days |
106 | * to the next date the given day of the week occurs. There | 110 | * to the next date the given day of the week occurs. There |
107 | * are two cases, that the new day is >= the current day, which means | 111 | * are two cases, that the new day is >= the current day, which means |
108 | * the new day has not occured yet or that the new day < the current day, | 112 | * the new day has not occured yet or that the new day < the current day, |
109 | * which means the new day is already passed (so we need to find the | 113 | * which means the new day is already passed (so we need to find the |
110 | * day in the next week). | 114 | * day in the next week). |
111 | */ | 115 | */ |
112 | QString dayName; | 116 | QString dayName; |
113 | int currentDay = QDate::currentDate().dayOfWeek(); | 117 | int currentDay = QDate::currentDate().dayOfWeek(); |
114 | for (int i = 1; i <= 7; ++i) | 118 | for (int i = 1; i <= 7; ++i) |
115 | { | 119 | { |
116 | dayName = KGlobal::locale()->weekDayName(i).lower(); | 120 | dayName = KGlobal::locale()->weekDayName(i).lower(); |
117 | if (i >= currentDay) | 121 | if (i >= currentDay) |
118 | mKeywordMap[dayName] = i - currentDay; | 122 | mKeywordMap[dayName] = i - currentDay; |
119 | else | 123 | else |
120 | mKeywordMap[dayName] = 7 - currentDay + i; | 124 | mKeywordMap[dayName] = 7 - currentDay + i; |
121 | } | 125 | } |
122 | 126 | ||
123 | mTextChanged = false; | 127 | mTextChanged = false; |
124 | mHandleInvalid = false; | 128 | mHandleInvalid = false; |
125 | // QWidget::setTabOrder( mDateEdit, mDateButton ); | 129 | // QWidget::setTabOrder( mDateEdit, mDateButton ); |
126 | } | 130 | } |
127 | 131 | ||
128 | KDateEdit::~KDateEdit() | 132 | KDateEdit::~KDateEdit() |
129 | { | 133 | { |
130 | delete mDateFrame; | 134 | delete mDateFrame; |
131 | } | 135 | } |
132 | void KDateEdit::clear() | 136 | void KDateEdit::clear() |
133 | { | 137 | { |
134 | bool b = mDateEdit->signalsBlocked(); | 138 | bool b = mDateEdit->signalsBlocked(); |
135 | mDateEdit->blockSignals(true); | 139 | mDateEdit->blockSignals(true); |
136 | mDateEdit->setText(""); | 140 | mDateEdit->setText(""); |
137 | mDateEdit->blockSignals(b); | 141 | mDateEdit->blockSignals(b); |
138 | } | 142 | } |
139 | void KDateEdit::goToNow() | 143 | void KDateEdit::goToNow() |
140 | { | 144 | { |
141 | setDate(QDate::currentDate() ); | 145 | setDate(QDate::currentDate() ); |
142 | emit setTimeTo( QTime::currentTime() ); | 146 | emit setTimeTo( QTime::currentTime() ); |
143 | } | 147 | } |
144 | void KDateEdit::setDate(QDate newDate) | 148 | void KDateEdit::setDate(QDate newDate) |
145 | { | 149 | { |
146 | if (!newDate.isValid() && !mHandleInvalid) | 150 | if (!newDate.isValid() && !mHandleInvalid) |
147 | return; | 151 | return; |
148 | if ( readDate() == newDate ) | 152 | if ( readDate() == newDate ) |
149 | return; | 153 | return; |
150 | QString dateString = ""; | 154 | QString dateString = ""; |
151 | if(newDate.isValid()) | 155 | if(newDate.isValid()) |
152 | dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); | 156 | dateString = KGlobal::locale()->formatDate( newDate, dateFormShort ); |
153 | 157 | ||
@@ -164,280 +168,280 @@ void KDateEdit::setDate(QDate newDate) | |||
164 | void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort) | 168 | void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateFormShort) |
165 | { | 169 | { |
166 | QString dateForm = dateFormShort ? | 170 | QString dateForm = dateFormShort ? |
167 | KGlobal::locale()->dateFormatShort() : | 171 | KGlobal::locale()->dateFormatShort() : |
168 | KGlobal::locale()->dateFormat(); | 172 | KGlobal::locale()->dateFormat(); |
169 | 173 | ||
170 | int begin = dateForm.find("%"); | 174 | int begin = dateForm.find("%"); |
171 | int space = 0; | 175 | int space = 0; |
172 | int allStrLength = 0; | 176 | int allStrLength = 0; |
173 | int strLength = 0; | 177 | int strLength = 0; |
174 | int repeat = 0; | 178 | int repeat = 0; |
175 | 179 | ||
176 | // witch? Day, Month or Year switch? | 180 | // witch? Day, Month or Year switch? |
177 | while(1){ | 181 | while(1){ |
178 | switch ( dateForm.at(begin + 1).latin1() ) | 182 | switch ( dateForm.at(begin + 1).latin1() ) |
179 | { | 183 | { |
180 | case 'd':// 16 (month day) | 184 | case 'd':// 16 (month day) |
181 | strLength = 2; //Ok | 185 | strLength = 2; //Ok |
182 | break; | 186 | break; |
183 | case 'm':// 01 (month) | 187 | case 'm':// 01 (month) |
184 | strLength = 2; //Ok | 188 | strLength = 2; //Ok |
185 | break; | 189 | break; |
186 | case 'a':// Mon (Weekday) | 190 | case 'a':// Mon (Weekday) |
187 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); | 191 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); |
188 | break; | 192 | break; |
189 | case 'A':// Monday (Weekday) | 193 | case 'A':// Monday (Weekday) |
190 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); | 194 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); |
191 | break; | 195 | break; |
192 | case 'b':// Jan (monthName) | 196 | case 'b':// Jan (monthName) |
193 | strLength = KGlobal::locale()->monthName(date.month(), true).length(); | 197 | strLength = KGlobal::locale()->monthName(date.month(), true).length(); |
194 | break; | 198 | break; |
195 | case 'B':// January (monthName) | 199 | case 'B':// January (monthName) |
196 | strLength = KGlobal::locale()->monthName(date.month(), false).length(); | 200 | strLength = KGlobal::locale()->monthName(date.month(), false).length(); |
197 | break; | 201 | break; |
198 | case 'y':// 04 (year short) | 202 | case 'y':// 04 (year short) |
199 | strLength = 2; //Ok | 203 | strLength = 2; //Ok |
200 | break; | 204 | break; |
201 | case 'Y':// 2004 (year) | 205 | case 'Y':// 2004 (year) |
202 | strLength = 4; //Ok | 206 | strLength = 4; //Ok |
203 | break; | 207 | break; |
204 | default: | 208 | default: |
205 | break; | 209 | break; |
206 | } | 210 | } |
207 | space = begin - (repeat++ * 2); | 211 | space = begin - (repeat++ * 2); |
208 | // all select? then dayswitch | 212 | // all select? then dayswitch |
209 | if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && | 213 | if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && |
210 | ( (dateForm.at(begin + 1).latin1() == 'd') || | 214 | ( (dateForm.at(begin + 1).latin1() == 'd') || |
211 | (dateForm.at(begin + 1).latin1() == 'a') || | 215 | (dateForm.at(begin + 1).latin1() == 'a') || |
212 | (dateForm.at(begin + 1).latin1() == 'A') ) ) { | 216 | (dateForm.at(begin + 1).latin1() == 'A') ) ) { |
213 | break; | 217 | break; |
214 | } | 218 | } |
215 | // mDateEdit-StringPos == CursorPosition(cpos) then break and set date | 219 | // mDateEdit-StringPos == CursorPosition(cpos) then break and set date |
216 | if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { | 220 | if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { |
217 | break; | 221 | break; |
218 | } | 222 | } |
219 | allStrLength += strLength; | 223 | allStrLength += strLength; |
220 | begin = dateForm.find("%", begin +1); | 224 | begin = dateForm.find("%", begin +1); |
221 | } | 225 | } |
222 | 226 | ||
223 | // set date | 227 | // set date |
224 | switch ( dateForm.at(begin + 1).latin1() ) { | 228 | switch ( dateForm.at(begin + 1).latin1() ) { |
225 | case 'd': | 229 | case 'd': |
226 | case 'a': | 230 | case 'a': |
227 | case 'A': | 231 | case 'A': |
228 | if(key == Key_Up) { | 232 | if(key == Qt::Key_Up) { |
229 | setDate( date.addDays( 1 ) ); | 233 | setDate( date.addDays( 1 ) ); |
230 | } | 234 | } |
231 | else if(key == Key_Down) { | 235 | else if(key == Qt::Key_Down) { |
232 | setDate( date.addDays( -1 ) ); | 236 | setDate( date.addDays( -1 ) ); |
233 | } | 237 | } |
234 | maxDay = readDate().day(); | 238 | maxDay = readDate().day(); |
235 | break; | 239 | break; |
236 | case 'm': | 240 | case 'm': |
237 | case 'b': | 241 | case 'b': |
238 | case 'B': | 242 | case 'B': |
239 | if(key == Key_Up) { | 243 | if(key == Qt::Key_Up) { |
240 | int year = ((date.month()+1)>12)?date.year()+1:date.year(); | 244 | int year = ((date.month()+1)>12)?date.year()+1:date.year(); |
241 | int month = ((date.month()+1)>12)?1:date.month()+1; | 245 | int month = ((date.month()+1)>12)?1:date.month()+1; |
242 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; | 246 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; |
243 | setDate( QDate( year, month, day ) ); | 247 | setDate( QDate( year, month, day ) ); |
244 | } else if(key == Key_Down) { | 248 | } else if(key == Qt::Key_Down) { |
245 | int year = ((date.month()-1)<1)?date.year()-1:date.year(); | 249 | int year = ((date.month()-1)<1)?date.year()-1:date.year(); |
246 | int month = ((date.month()-1)<1)?12:date.month()-1; | 250 | int month = ((date.month()-1)<1)?12:date.month()-1; |
247 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; | 251 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; |
248 | setDate( QDate( year, month, day ) ); | 252 | setDate( QDate( year, month, day ) ); |
249 | } | 253 | } |
250 | break; | 254 | break; |
251 | case 'y': | 255 | case 'y': |
252 | case 'Y': | 256 | case 'Y': |
253 | if(key == Key_Up) { | 257 | if(key == Qt::Key_Up) { |
254 | setDate( QDate( date.year() + 1, date.month() , date.day()) ); | 258 | setDate( QDate( date.year() + 1, date.month() , date.day()) ); |
255 | } | 259 | } |
256 | else if(key == Key_Down) { | 260 | else if(key == Qt::Key_Down) { |
257 | setDate( QDate( date.year() - 1, date.month() , date.day()) ); | 261 | setDate( QDate( date.year() - 1, date.month() , date.day()) ); |
258 | } | 262 | } |
259 | break; | 263 | break; |
260 | /* default: | 264 | /* default: |
261 | if(key == Key_Up) { | 265 | if(key == Key_Up) { |
262 | setDate( date.addDays( 1 ) ); | 266 | setDate( date.addDays( 1 ) ); |
263 | } else if(key == Key_Down) { | 267 | } else if(key == Key_Down) { |
264 | setDate( date.addDays( -1 ) ); | 268 | setDate( date.addDays( -1 ) ); |
265 | } | 269 | } |
266 | break;*/ | 270 | break;*/ |
267 | } | 271 | } |
268 | 272 | ||
269 | date = readDate(); | 273 | date = readDate(); |
270 | begin = dateForm.find("%"); | 274 | begin = dateForm.find("%"); |
271 | int allSelectStrLength = 0; | 275 | int allSelectStrLength = 0; |
272 | int selectStrLength = 0; | 276 | int selectStrLength = 0; |
273 | 277 | ||
274 | // set selection do new date an set cursor at end of selection | 278 | // set selection do new date an set cursor at end of selection |
275 | for(int i = 0; i < repeat; i++){ | 279 | for(int i = 0; i < repeat; i++){ |
276 | switch ( dateForm.at(begin + 1).latin1() ) | 280 | switch ( dateForm.at(begin + 1).latin1() ) |
277 | { | 281 | { |
278 | case 'd':// 16 (month day) | 282 | case 'd':// 16 (month day) |
279 | selectStrLength = 2; //Ok | 283 | selectStrLength = 2; //Ok |
280 | break; | 284 | break; |
281 | case 'm':// 01 (month) | 285 | case 'm':// 01 (month) |
282 | selectStrLength = 2; //Ok | 286 | selectStrLength = 2; //Ok |
283 | break; | 287 | break; |
284 | case 'a':// Mon (Weekday short) | 288 | case 'a':// Mon (Weekday short) |
285 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); | 289 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); |
286 | break; | 290 | break; |
287 | case 'A':// Monday (Weekday) | 291 | case 'A':// Monday (Weekday) |
288 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); | 292 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); |
289 | break; | 293 | break; |
290 | case 'b':// Jan (monthName short) | 294 | case 'b':// Jan (monthName short) |
291 | selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); | 295 | selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); |
292 | break; | 296 | break; |
293 | case 'B':// January (monthName) | 297 | case 'B':// January (monthName) |
294 | selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); | 298 | selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); |
295 | break; | 299 | break; |
296 | case 'y':// 04 (year short) | 300 | case 'y':// 04 (year short) |
297 | selectStrLength = 2; //Ok | 301 | selectStrLength = 2; //Ok |
298 | break; | 302 | break; |
299 | case 'Y':// 2004 (year) | 303 | case 'Y':// 2004 (year) |
300 | selectStrLength = 4; //Ok | 304 | selectStrLength = 4; //Ok |
301 | break; | 305 | break; |
302 | default: | 306 | default: |
303 | break; | 307 | break; |
304 | } | 308 | } |
305 | space = begin - (i * 2); | 309 | space = begin - (i * 2); |
306 | allSelectStrLength += selectStrLength; | 310 | allSelectStrLength += selectStrLength; |
307 | begin = dateForm.find("%", begin +1); | 311 | begin = dateForm.find("%", begin +1); |
308 | } | 312 | } |
309 | // set selection from begin of date | 313 | // set selection from begin of date |
310 | setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); | 314 | setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); |
311 | *cpos = space + allSelectStrLength; | 315 | *cpos = space + allSelectStrLength; |
312 | emit(dateChanged(date)); | 316 | emit(dateChanged(date)); |
313 | 317 | ||
314 | return; | 318 | return; |
315 | } | 319 | } |
316 | 320 | ||
317 | void KDateEdit::setHandleInvalid(bool handleInvalid) | 321 | void KDateEdit::setHandleInvalid(bool handleInvalid) |
318 | { | 322 | { |
319 | mHandleInvalid = handleInvalid; | 323 | mHandleInvalid = handleInvalid; |
320 | } | 324 | } |
321 | 325 | ||
322 | void KDateEdit::setEnabled(bool on) | 326 | void KDateEdit::setEnabled(bool on) |
323 | { | 327 | { |
324 | mDateEdit->setEnabled(on); | 328 | mDateEdit->setEnabled(on); |
325 | mDateButton->setEnabled(on); | 329 | mDateButton->setEnabled(on); |
326 | } | 330 | } |
327 | 331 | ||
328 | QDate KDateEdit::date() const | 332 | QDate KDateEdit::date() const |
329 | { | 333 | { |
330 | QDate date = readDate(); | 334 | QDate date = readDate(); |
331 | 335 | ||
332 | if (date.isValid() || mHandleInvalid) { | 336 | if (date.isValid() || mHandleInvalid) { |
333 | return date; | 337 | return date; |
334 | } else { | 338 | } else { |
335 | KNotifyClient::beep(); | 339 | KNotifyClient::beep(); |
336 | return QDate::currentDate(); | 340 | return QDate::currentDate(); |
337 | } | 341 | } |
338 | } | 342 | } |
339 | 343 | ||
340 | void KDateEdit::keyPressEvent(QKeyEvent *e) | 344 | void KDateEdit::keyPressEvent(QKeyEvent *e) |
341 | { | 345 | { |
342 | QDate date = readDate(); | 346 | QDate date = readDate(); |
343 | int cpos = mDateEdit->cursorPosition(); | 347 | int cpos = mDateEdit->cursorPosition(); |
344 | 348 | ||
345 | switch(e->key()) | 349 | switch(e->key()) |
346 | { | 350 | { |
347 | case Key_Escape: | 351 | case Qt::Key_Escape: |
348 | mDateEdit->deselect(); | 352 | mDateEdit->deselect(); |
349 | case Key_Tab: | 353 | case Qt::Key_Tab: |
350 | QHBox::keyPressEvent(e); | 354 | Q3HBox::keyPressEvent(e); |
351 | break; | 355 | break; |
352 | case Key_Up: | 356 | case Qt::Key_Up: |
353 | // when date invalid then set to currend and return | 357 | // when date invalid then set to currend and return |
354 | if(!date.isValid()) { | 358 | if(!date.isValid()) { |
355 | date = QDate::currentDate(); | 359 | date = QDate::currentDate(); |
356 | setDate(date); | 360 | setDate(date); |
357 | mDateEdit->setCursorPosition(cpos); | 361 | mDateEdit->setCursorPosition(cpos); |
358 | emit(dateChanged(date)); | 362 | emit(dateChanged(date)); |
359 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); | 363 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); |
360 | KMessageBox::information( 0, text ); | 364 | KMessageBox::information( 0, text ); |
361 | return; | 365 | return; |
362 | } | 366 | } |
363 | setDate(date, &cpos, Key_Up, dateFormShort); | 367 | setDate(date, &cpos, Qt::Key_Up, dateFormShort); |
364 | break; | 368 | break; |
365 | case Key_Down: | 369 | case Qt::Key_Down: |
366 | // when date invalid then set to current and return | 370 | // when date invalid then set to current and return |
367 | if(!date.isValid()) { | 371 | if(!date.isValid()) { |
368 | date = QDate::currentDate(); | 372 | date = QDate::currentDate(); |
369 | setDate(date); | 373 | setDate(date); |
370 | mDateEdit->setCursorPosition(cpos); | 374 | mDateEdit->setCursorPosition(cpos); |
371 | emit(dateChanged(date)); | 375 | emit(dateChanged(date)); |
372 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); | 376 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); |
373 | KMessageBox::information( 0, text ); | 377 | KMessageBox::information( 0, text ); |
374 | return; | 378 | return; |
375 | } | 379 | } |
376 | setDate(date, &cpos, Key_Down, dateFormShort); | 380 | setDate(date, &cpos, Qt::Key_Down, dateFormShort); |
377 | break; | 381 | break; |
378 | default: | 382 | default: |
379 | QHBox::keyPressEvent(e); | 383 | Q3HBox::keyPressEvent(e); |
380 | break; | 384 | break; |
381 | } // switch | 385 | } // switch |
382 | mDateEdit->setCursorPosition(cpos); | 386 | mDateEdit->setCursorPosition(cpos); |
383 | } | 387 | } |
384 | 388 | ||
385 | void KDateEdit::setSelect( int from, int to ) | 389 | void KDateEdit::setSelect( int from, int to ) |
386 | { | 390 | { |
387 | // return; | 391 | // return; |
388 | mDateEdit->setSelection( from , to ); | 392 | mDateEdit->setSelection( from , to ); |
389 | } | 393 | } |
390 | 394 | ||
391 | void KDateEdit::toggleDatePicker() | 395 | void KDateEdit::toggleDatePicker() |
392 | { | 396 | { |
393 | if( mDateFrame->isVisible() ) { | 397 | if( mDateFrame->isVisible() ) { |
394 | mDateFrame->hide(); | 398 | mDateFrame->hide(); |
395 | } else { | 399 | } else { |
396 | QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); | 400 | QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); |
397 | QSize datepickersize = mDatePicker->sizeHint(); | 401 | QSize datepickersize = mDatePicker->sizeHint(); |
398 | 402 | ||
399 | if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); | 403 | if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); |
400 | 404 | ||
401 | int h = QApplication::desktop()->height(); | 405 | int h = QApplication::desktop()->height(); |
402 | 406 | ||
403 | if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); | 407 | if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); |
404 | 408 | ||
405 | mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), | 409 | mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), |
406 | datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); | 410 | datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); |
407 | 411 | ||
408 | QDate date = readDate(); | 412 | QDate date = readDate(); |
409 | if(date.isValid()) { | 413 | if(date.isValid()) { |
410 | mDatePicker->setDate(date); | 414 | mDatePicker->setDate(date); |
411 | } else { | 415 | } else { |
412 | mDatePicker->setDate(QDate::currentDate()); | 416 | mDatePicker->setDate(QDate::currentDate()); |
413 | } | 417 | } |
414 | mDateFrame->show(); | 418 | mDateFrame->show(); |
415 | } | 419 | } |
416 | } | 420 | } |
417 | 421 | ||
418 | 422 | ||
419 | void KDateEdit::lineEnterPressed() | 423 | void KDateEdit::lineEnterPressed() |
420 | { | 424 | { |
421 | QDate date = readDate(); | 425 | QDate date = readDate(); |
422 | 426 | ||
423 | if(date.isValid()) | 427 | if(date.isValid()) |
424 | { | 428 | { |
425 | // Update the edit. This is needed if the user has entered a | 429 | // Update the edit. This is needed if the user has entered a |
426 | // word rather than the actual date. | 430 | // word rather than the actual date. |
427 | setDate(date); | 431 | setDate(date); |
428 | emit(dateChanged(date)); | 432 | emit(dateChanged(date)); |
429 | emit returnPressed(); | 433 | emit returnPressed(); |
430 | } | 434 | } |
431 | else | 435 | else |
432 | { | 436 | { |
433 | if ( withoutDp ) { | 437 | if ( withoutDp ) { |
434 | KNotifyClient::beep(); | 438 | KNotifyClient::beep(); |
435 | } else { | 439 | } else { |
436 | if ( !mDateEdit->text().isEmpty() ) { | 440 | if ( !mDateEdit->text().isEmpty() ) { |
437 | mTextChanged = false; | 441 | mTextChanged = false; |
438 | QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); | 442 | QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); |
439 | if ( isVisible() ) | 443 | if ( isVisible() ) |
440 | if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { | 444 | if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { |
441 | setDate( QDate::currentDate() ); | 445 | setDate( QDate::currentDate() ); |
442 | emit dateChanged( QDate::currentDate() ); | 446 | emit dateChanged( QDate::currentDate() ); |
443 | } | 447 | } |
diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h index 2d8c452..38eacde 100644 --- a/libkdepim/kdateedit.h +++ b/libkdepim/kdateedit.h | |||
@@ -1,143 +1,146 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | #ifndef KDATEEDIT_H | 24 | #ifndef KDATEEDIT_H |
25 | #define KDATEEDIT_H | 25 | #define KDATEEDIT_H |
26 | 26 | ||
27 | #include <qhbox.h> | 27 | #include <q3hbox.h> |
28 | #include <qvbox.h> | 28 | #include <q3vbox.h> |
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | //Added by qt3to4: | ||
32 | #include <QKeyEvent> | ||
33 | #include <QEvent> | ||
31 | 34 | ||
32 | class QLineEdit; | 35 | class QLineEdit; |
33 | class QPushButton; | 36 | class QPushButton; |
34 | class QObject; | 37 | class QObject; |
35 | class QEvent; | 38 | class QEvent; |
36 | class KDatePicker; | 39 | class KDatePicker; |
37 | class KDateValidator; | 40 | class KDateValidator; |
38 | 41 | ||
39 | /** | 42 | /** |
40 | * A date editing widget that consists of a line edit followed by | 43 | * A date editing widget that consists of a line edit followed by |
41 | * a small push button. The line edit contains the date in text form, | 44 | * a small push button. The line edit contains the date in text form, |
42 | * and the push button will display a 'popup' style date picker. | 45 | * and the push button will display a 'popup' style date picker. |
43 | * | 46 | * |
44 | * This widget also supports advanced features like allowing the user | 47 | * This widget also supports advanced features like allowing the user |
45 | * to type in the day name to get the date. The following keywords | 48 | * to type in the day name to get the date. The following keywords |
46 | * are supported (in the native language): tomorrow, yesturday, today, | 49 | * are supported (in the native language): tomorrow, yesturday, today, |
47 | * monday, tuesday, wednesday, thursday, friday, saturday, sunday. | 50 | * monday, tuesday, wednesday, thursday, friday, saturday, sunday. |
48 | * | 51 | * |
49 | * @author Cornelius Schumacher <schumacher@kde.org> | 52 | * @author Cornelius Schumacher <schumacher@kde.org> |
50 | * @author Mike Pilone <mpilone@slac.com> | 53 | * @author Mike Pilone <mpilone@slac.com> |
51 | */ | 54 | */ |
52 | class KDateEdit : public QHBox | 55 | class KDateEdit : public Q3HBox |
53 | { | 56 | { |
54 | Q_OBJECT | 57 | Q_OBJECT |
55 | public: | 58 | public: |
56 | KDateEdit(QWidget *parent=0, const char *name=0, bool withoutDP = false ); | 59 | KDateEdit(QWidget *parent=0, const char *name=0, bool withoutDP = false ); |
57 | virtual ~KDateEdit(); | 60 | virtual ~KDateEdit(); |
58 | 61 | ||
59 | /** @return True if the date in the text edit is valid, | 62 | /** @return True if the date in the text edit is valid, |
60 | * false otherwise. This will not modify the display of the date, | 63 | * false otherwise. This will not modify the display of the date, |
61 | * but only check for validity. | 64 | * but only check for validity. |
62 | */ | 65 | */ |
63 | bool inputIsValid(); | 66 | bool inputIsValid(); |
64 | 67 | ||
65 | /** @return The date entered. This will not | 68 | /** @return The date entered. This will not |
66 | * modify the display of the date, but only return it. | 69 | * modify the display of the date, but only return it. |
67 | */ | 70 | */ |
68 | QDate date() const; | 71 | QDate date() const; |
69 | 72 | ||
70 | /** @param handleInvalid If true the date edit accepts invalid dates | 73 | /** @param handleInvalid If true the date edit accepts invalid dates |
71 | * and displays them as the empty ("") string. It also returns an invalid date. | 74 | * and displays them as the empty ("") string. It also returns an invalid date. |
72 | * If false (default) invalid dates are not accepted and instead the date | 75 | * If false (default) invalid dates are not accepted and instead the date |
73 | * of today will be returned. | 76 | * of today will be returned. |
74 | */ | 77 | */ |
75 | void setHandleInvalid(bool handleInvalid); | 78 | void setHandleInvalid(bool handleInvalid); |
76 | 79 | ||
77 | /** Checks for a focus out event. The display of the date is updated | 80 | /** Checks for a focus out event. The display of the date is updated |
78 | * to display the proper date when the focus leaves. | 81 | * to display the proper date when the focus leaves. |
79 | */ | 82 | */ |
80 | virtual bool eventFilter(QObject *o, QEvent *e); | 83 | virtual bool eventFilter(QObject *o, QEvent *e); |
81 | void toggleDateFormat(); | 84 | void toggleDateFormat(); |
82 | void clear(); | 85 | void clear(); |
83 | signals: | 86 | signals: |
84 | /** This signal is emitted whenever the user modifies the date. This | 87 | /** This signal is emitted whenever the user modifies the date. This |
85 | * may not get emitted until the user presses enter in the line edit or | 88 | * may not get emitted until the user presses enter in the line edit or |
86 | * focus leaves the widget (ie: the user confirms their selection). | 89 | * focus leaves the widget (ie: the user confirms their selection). |
87 | */ | 90 | */ |
88 | void dateChanged(QDate); | 91 | void dateChanged(QDate); |
89 | void returnPressed(); | 92 | void returnPressed(); |
90 | void setTimeTo( QTime ); | 93 | void setTimeTo( QTime ); |
91 | public slots: | 94 | public slots: |
92 | /** Sets the date. | 95 | /** Sets the date. |
93 | * | 96 | * |
94 | * @param date The new date to display. This date must be valid or | 97 | * @param date The new date to display. This date must be valid or |
95 | * it will not be displayed. | 98 | * it will not be displayed. |
96 | */ | 99 | */ |
97 | void setDate(QDate date); | 100 | void setDate(QDate date); |
98 | // set Date with key_up key_down to relation of cursor Position | 101 | // set Date with key_up key_down to relation of cursor Position |
99 | // and set selection from begin to end of single date | 102 | // and set selection from begin to end of single date |
100 | void setDate(QDate, int *cpos, const int, const bool); | 103 | void setDate(QDate, int *cpos, const int, const bool); |
101 | 104 | ||
102 | /** Sets the date edit to be enabled or disabled (grayed out) | 105 | /** Sets the date edit to be enabled or disabled (grayed out) |
103 | * | 106 | * |
104 | * @param on Enabled if true, disabled if false | 107 | * @param on Enabled if true, disabled if false |
105 | */ | 108 | */ |
106 | void setEnabled(bool on); | 109 | void setEnabled(bool on); |
107 | 110 | ||
108 | protected slots: | 111 | protected slots: |
109 | void toggleDatePicker(); | 112 | void toggleDatePicker(); |
110 | void lineEnterPressed(); | 113 | void lineEnterPressed(); |
111 | void textChanged(const QString &); | 114 | void textChanged(const QString &); |
112 | void goToNow(); | 115 | void goToNow(); |
113 | 116 | ||
114 | private: | 117 | private: |
115 | /** Reads the text from the line edit. If the text is a keyword, the | 118 | /** Reads the text from the line edit. If the text is a keyword, the |
116 | * word will be translated to a date. If the text is not a keyword, the | 119 | * word will be translated to a date. If the text is not a keyword, the |
117 | * text will be interpreted as a date. | 120 | * text will be interpreted as a date. |
118 | */ | 121 | */ |
119 | QDate readDate() const; | 122 | QDate readDate() const; |
120 | 123 | ||
121 | /** Maps the text that the user can enter to the offset in days from | 124 | /** Maps the text that the user can enter to the offset in days from |
122 | * today. For example, the text 'tomorrow' is mapped to +1. | 125 | * today. For example, the text 'tomorrow' is mapped to +1. |
123 | */ | 126 | */ |
124 | QMap<QString, int> mKeywordMap; | 127 | QMap<QString, int> mKeywordMap; |
125 | bool mTextChanged; | 128 | bool mTextChanged; |
126 | bool mHandleInvalid; | 129 | bool mHandleInvalid; |
127 | 130 | ||
128 | QPushButton *mDateButton; | 131 | QPushButton *mDateButton; |
129 | QLineEdit *mDateEdit; | 132 | QLineEdit *mDateEdit; |
130 | KDatePicker *mDatePicker; | 133 | KDatePicker *mDatePicker; |
131 | QVBox *mDateFrame; | 134 | Q3VBox *mDateFrame; |
132 | int maxDay; | 135 | int maxDay; |
133 | bool withoutDp; | 136 | bool withoutDp; |
134 | 137 | ||
135 | protected: | 138 | protected: |
136 | virtual void keyPressEvent(QKeyEvent *qke); | 139 | virtual void keyPressEvent(QKeyEvent *qke); |
137 | void setSelect ( int, int ); | 140 | void setSelect ( int, int ); |
138 | bool dateFormShort; | 141 | bool dateFormShort; |
139 | char lengthMonthName; | 142 | char lengthMonthName; |
140 | 143 | ||
141 | }; | 144 | }; |
142 | 145 | ||
143 | #endif | 146 | #endif |
diff --git a/libkdepim/kdatepicker.cpp b/libkdepim/kdatepicker.cpp index 68ef943..28b65cf 100644 --- a/libkdepim/kdatepicker.cpp +++ b/libkdepim/kdatepicker.cpp | |||
@@ -1,107 +1,111 @@ | |||
1 | /* -*- C++ -*- | 1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) | 3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) |
4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) | 4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) |
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "kdatepicker.h" | 21 | #include "kdatepicker.h" |
22 | #include <kglobal.h> | 22 | #include <kglobal.h> |
23 | #include <kapplication.h> | 23 | #include <kapplication.h> |
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | #include <kiconloader.h> | 25 | #include <kiconloader.h> |
26 | #include <qframe.h> | 26 | #include <q3frame.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
30 | #include <qfont.h> | 30 | #include <qfont.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qvalidator.h> | 33 | #include <qvalidator.h> |
34 | //Added by qt3to4: | ||
35 | #include <QResizeEvent> | ||
36 | #include <QKeyEvent> | ||
37 | #include <QDesktopWidget> | ||
34 | #include <kdebug.h> | 38 | #include <kdebug.h> |
35 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
36 | #include <kglobalsettings.h> | 40 | #include <kglobalsettings.h> |
37 | #include "kdatetbl.h" | 41 | #include "kdatetbl.h" |
38 | #include "kdateedit.h" | 42 | #include "kdateedit.h" |
39 | //#include "kdatepicker.moc" | 43 | //#include "kdatepicker.moc" |
40 | 44 | ||
41 | 45 | ||
42 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) | 46 | KDatePicker::KDatePicker(QWidget *parent, QDate dt, const char *name) |
43 | : QFrame(parent,name), | 47 | : Q3Frame(parent,name), |
44 | yearForward(new QToolButton(this)), | 48 | yearForward(new QToolButton(this)), |
45 | yearBackward(new QToolButton(this)), | 49 | yearBackward(new QToolButton(this)), |
46 | monthForward(new QToolButton(this)), | 50 | monthForward(new QToolButton(this)), |
47 | monthBackward(new QToolButton(this)), | 51 | monthBackward(new QToolButton(this)), |
48 | selectMonth(new QToolButton(this)), | 52 | selectMonth(new QToolButton(this)), |
49 | selectYear(new QToolButton(this)), | 53 | selectYear(new QToolButton(this)), |
50 | todayBut(new QToolButton(this)), | 54 | todayBut(new QToolButton(this)), |
51 | //line(new QLineEdit(this)), | 55 | //line(new QLineEdit(this)), |
52 | val(new KDateValidator(this)) | 56 | val(new KDateValidator(this)) |
53 | //table(new KDateTable(this)), | 57 | //table(new KDateTable(this)), |
54 | //fontsize(1) | 58 | //fontsize(1) |
55 | { | 59 | { |
56 | QFont fo = KGlobalSettings::generalFont(); | 60 | QFont fo = KGlobalSettings::generalFont(); |
57 | int add = 2; | 61 | int add = 2; |
58 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 62 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
59 | add += 4; | 63 | add += 4; |
60 | fo.setPointSize(fo.pointSize()+add ); | 64 | fo.setPointSize(fo.pointSize()+add ); |
61 | setFont( fo ); | 65 | setFont( fo ); |
62 | table = new KDateTable(this); | 66 | table = new KDateTable(this); |
63 | setFontSize(font().pointSize()); | 67 | setFontSize(font().pointSize()); |
64 | //line->setValidator(val); | 68 | //line->setValidator(val); |
65 | lineDate = new KDateEdit( this, "dateediipicker", true ); | 69 | lineDate = new KDateEdit( this, "dateediipicker", true ); |
66 | yearForward->setPixmap(SmallIcon("3rightarrowB")); | 70 | yearForward->setPixmap(SmallIcon("3rightarrowB")); |
67 | yearBackward->setPixmap(SmallIcon("3leftarrowB")); | 71 | yearBackward->setPixmap(SmallIcon("3leftarrowB")); |
68 | monthForward->setPixmap(SmallIcon("2rightarrowB")); | 72 | monthForward->setPixmap(SmallIcon("2rightarrowB")); |
69 | monthBackward->setPixmap(SmallIcon("2leftarrowB")); | 73 | monthBackward->setPixmap(SmallIcon("2leftarrowB")); |
70 | todayBut->setPixmap(SmallIcon("today")); | 74 | todayBut->setPixmap(SmallIcon("today")); |
71 | setDate(dt); // set button texts | 75 | setDate(dt); // set button texts |
72 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); | 76 | connect(table, SIGNAL(dateChanged(QDate)), SLOT(dateChangedSlot(QDate))); |
73 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); | 77 | connect(table, SIGNAL(tableClicked()), SLOT(tableClickedSlot())); |
74 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); | 78 | connect(monthForward, SIGNAL(clicked()), SLOT(monthForwardClicked())); |
75 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); | 79 | connect(monthBackward, SIGNAL(clicked()), SLOT(monthBackwardClicked())); |
76 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); | 80 | connect(yearForward, SIGNAL(clicked()), SLOT(yearForwardClicked())); |
77 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); | 81 | connect(yearBackward, SIGNAL(clicked()), SLOT(yearBackwardClicked())); |
78 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); | 82 | connect(selectMonth, SIGNAL(clicked()), SLOT(selectMonthClicked())); |
79 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); | 83 | connect(selectYear, SIGNAL(clicked()), SLOT(selectYearClicked())); |
80 | connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); | 84 | connect(todayBut, SIGNAL(clicked()), SLOT(goToday())); |
81 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 85 | //connect(line, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
82 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); | 86 | connect(lineDate, SIGNAL(dateChanged(QDate)), SLOT(slotSetDate(QDate))); |
83 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); | 87 | connect(lineDate, SIGNAL(returnPressed()), SLOT(lineEnterPressed())); |
84 | table->setFocus(); | 88 | table->setFocus(); |
85 | 89 | ||
86 | } | 90 | } |
87 | 91 | ||
88 | KDatePicker::~KDatePicker() | 92 | KDatePicker::~KDatePicker() |
89 | { | 93 | { |
90 | } | 94 | } |
91 | 95 | ||
92 | void | 96 | void |
93 | KDatePicker::resizeEvent(QResizeEvent*) | 97 | KDatePicker::resizeEvent(QResizeEvent*) |
94 | { | 98 | { |
95 | QWidget *buttons[] = { | 99 | QWidget *buttons[] = { |
96 | yearBackward, | 100 | yearBackward, |
97 | monthBackward, | 101 | monthBackward, |
98 | selectMonth, | 102 | selectMonth, |
99 | selectYear, | 103 | selectYear, |
100 | monthForward, | 104 | monthForward, |
101 | yearForward }; | 105 | yearForward }; |
102 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); | 106 | const int NoOfButtons=sizeof(buttons)/sizeof(buttons[0]); |
103 | QSize sizes[NoOfButtons]; | 107 | QSize sizes[NoOfButtons]; |
104 | int buttonHeight=0; | 108 | int buttonHeight=0; |
105 | int count; | 109 | int count; |
106 | int w; | 110 | int w; |
107 | int x=0; | 111 | int x=0; |
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h index 3db9a89..4d904da 100644 --- a/libkdepim/kdatepicker.h +++ b/libkdepim/kdatepicker.h | |||
@@ -1,115 +1,118 @@ | |||
1 | /* -*- C++ -*- | 1 | /* -*- C++ -*- |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) | 3 | Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) |
4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) | 4 | (C) 1998-2001 Mirko Boehm (mirko@kde.org) |
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef MICROKDE_KDATEPICKER_H | 20 | #ifndef MICROKDE_KDATEPICKER_H |
21 | #define MICROKDE_KDATEPICKER_H | 21 | #define MICROKDE_KDATEPICKER_H |
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qframe.h> | 23 | #include <q3frame.h> |
24 | #include <qevent.h> | 24 | #include <qevent.h> |
25 | //Added by qt3to4: | ||
26 | #include <QResizeEvent> | ||
27 | #include <QKeyEvent> | ||
25 | 28 | ||
26 | class QLineEdit; | 29 | class QLineEdit; |
27 | class QToolButton; | 30 | class QToolButton; |
28 | class KDateValidator; | 31 | class KDateValidator; |
29 | class KDateTable; | 32 | class KDateTable; |
30 | class KDateEdit; | 33 | class KDateEdit; |
31 | 34 | ||
32 | /** | 35 | /** |
33 | * Provides a widget for calendar date input. | 36 | * Provides a widget for calendar date input. |
34 | * | 37 | * |
35 | * Different from the | 38 | * Different from the |
36 | * previous versions, it now emits two types of signals, either | 39 | * previous versions, it now emits two types of signals, either |
37 | * @ref dateSelected() or @ref dateEntered() (see documentation for both | 40 | * @ref dateSelected() or @ref dateEntered() (see documentation for both |
38 | * signals). | 41 | * signals). |
39 | * | 42 | * |
40 | * A line edit has been added in the newer versions to allow the user | 43 | * A line edit has been added in the newer versions to allow the user |
41 | * to select a date directly by entering numbers like 19990101 | 44 | * to select a date directly by entering numbers like 19990101 |
42 | * or 990101. | 45 | * or 990101. |
43 | * | 46 | * |
44 | * @image kdatepicker.png KDatePicker | 47 | * @image kdatepicker.png KDatePicker |
45 | * | 48 | * |
46 | * @version $Id$ | 49 | * @version $Id$ |
47 | * @author Tim Gilman, Mirko Boehm | 50 | * @author Tim Gilman, Mirko Boehm |
48 | * | 51 | * |
49 | * @short A date selection widget. | 52 | * @short A date selection widget. |
50 | **/ | 53 | **/ |
51 | class KDatePicker: public QFrame | 54 | class KDatePicker: public Q3Frame |
52 | { | 55 | { |
53 | Q_OBJECT | 56 | Q_OBJECT |
54 | public: | 57 | public: |
55 | /** The usual constructor. The given date will be displayed | 58 | /** The usual constructor. The given date will be displayed |
56 | * initially. | 59 | * initially. |
57 | **/ | 60 | **/ |
58 | KDatePicker(QWidget *parent=0, | 61 | KDatePicker(QWidget *parent=0, |
59 | QDate=QDate::currentDate(), | 62 | QDate=QDate::currentDate(), |
60 | const char *name=0); | 63 | const char *name=0); |
61 | /** | 64 | /** |
62 | * The destructor. | 65 | * The destructor. |
63 | **/ | 66 | **/ |
64 | virtual ~KDatePicker(); | 67 | virtual ~KDatePicker(); |
65 | 68 | ||
66 | /** The size hint for date pickers. The size hint recommends the | 69 | /** The size hint for date pickers. The size hint recommends the |
67 | * minimum size of the widget so that all elements may be placed | 70 | * minimum size of the widget so that all elements may be placed |
68 | * without clipping. This sometimes looks ugly, so when using the | 71 | * without clipping. This sometimes looks ugly, so when using the |
69 | * size hint, try adding 28 to each of the reported numbers of | 72 | * size hint, try adding 28 to each of the reported numbers of |
70 | * pixels. | 73 | * pixels. |
71 | **/ | 74 | **/ |
72 | QSize sizeHint() const; | 75 | QSize sizeHint() const; |
73 | 76 | ||
74 | /** | 77 | /** |
75 | * Sets the date. | 78 | * Sets the date. |
76 | * | 79 | * |
77 | * @returns @p false and does not change anything | 80 | * @returns @p false and does not change anything |
78 | * if the date given is invalid. | 81 | * if the date given is invalid. |
79 | **/ | 82 | **/ |
80 | bool setDate(const QDate&); | 83 | bool setDate(const QDate&); |
81 | 84 | ||
82 | /** | 85 | /** |
83 | * Returns the selected date. | 86 | * Returns the selected date. |
84 | * @deprecated | 87 | * @deprecated |
85 | **/ | 88 | **/ |
86 | const QDate& getDate() const; | 89 | const QDate& getDate() const; |
87 | 90 | ||
88 | /** | 91 | /** |
89 | * @returns the selected date. | 92 | * @returns the selected date. |
90 | */ | 93 | */ |
91 | const QDate &date() const; | 94 | const QDate &date() const; |
92 | 95 | ||
93 | /** | 96 | /** |
94 | * Enables or disables the widget. | 97 | * Enables or disables the widget. |
95 | **/ | 98 | **/ |
96 | void setEnabled(bool); | 99 | void setEnabled(bool); |
97 | 100 | ||
98 | /** | 101 | /** |
99 | * Sets the font size of the widgets elements. | 102 | * Sets the font size of the widgets elements. |
100 | **/ | 103 | **/ |
101 | void setFontSize(int); | 104 | void setFontSize(int); |
102 | /** | 105 | /** |
103 | * Returns the font size of the widget elements. | 106 | * Returns the font size of the widget elements. |
104 | */ | 107 | */ |
105 | int fontSize() const | 108 | int fontSize() const |
106 | { return fontsize; } | 109 | { return fontsize; } |
107 | protected: | 110 | protected: |
108 | /// the resize event | 111 | /// the resize event |
109 | void resizeEvent(QResizeEvent*); | 112 | void resizeEvent(QResizeEvent*); |
110 | QToolButton *todayBut; | 113 | QToolButton *todayBut; |
111 | /// the year forward button | 114 | /// the year forward button |
112 | QToolButton *yearForward; | 115 | QToolButton *yearForward; |
113 | /// the year backward button | 116 | /// the year backward button |
114 | QToolButton *yearBackward; | 117 | QToolButton *yearBackward; |
115 | /// the month forward button | 118 | /// the month forward button |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 9c28425..3677e87 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,225 +1,225 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kglobalsettings.h> | 35 | #include <kglobalsettings.h> |
36 | #include <kstaticdeleter.h> | 36 | #include <kstaticdeleter.h> |
37 | 37 | ||
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qfile.h> | 39 | #include <qfile.h> |
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <qtextstream.h> | 41 | #include <q3textstream.h> |
42 | #include <qapplication.h> | 42 | #include <qapplication.h> |
43 | #include "kpimglobalprefs.h" | 43 | #include "kpimglobalprefs.h" |
44 | 44 | ||
45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 45 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; | 46 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; |
47 | 47 | ||
48 | 48 | ||
49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 49 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
50 | : KPrefs("microkdeglobalrc") | 50 | : KPrefs("microkdeglobalrc") |
51 | { | 51 | { |
52 | mLocaleDict = 0; | 52 | mLocaleDict = 0; |
53 | KPrefs::setCurrentGroup("Fonts"); | 53 | KPrefs::setCurrentGroup("Fonts"); |
54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); | 54 | addItemFont("ApplicationFont",&mApplicationFont,KGlobalSettings::generalFont() ); |
55 | KPrefs::setCurrentGroup("Locale"); | 55 | KPrefs::setCurrentGroup("Locale"); |
56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 56 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
57 | addItemInt("PreferredTime",&mPreferredTime,0); | 57 | addItemInt("PreferredTime",&mPreferredTime,0); |
58 | addItemInt("PreferredDate",&mPreferredDate,0); | 58 | addItemInt("PreferredDate",&mPreferredDate,0); |
59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 59 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); | 60 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%AK %d. %b %y"); |
61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 61 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
62 | 62 | ||
63 | KPrefs::setCurrentGroup("Colors"); | 63 | KPrefs::setCurrentGroup("Colors"); |
64 | addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor()); | 64 | addItemColor("AlternateBGcolor",&mAlternateColor,KGlobalSettings::alternateBackgroundColor()); |
65 | 65 | ||
66 | 66 | ||
67 | KPrefs::setCurrentGroup("Time & Date"); | 67 | KPrefs::setCurrentGroup("Time & Date"); |
68 | 68 | ||
69 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 69 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
70 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 70 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
71 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 71 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
72 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 72 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
73 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 73 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
74 | 74 | ||
75 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 75 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
76 | 76 | ||
77 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 77 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
78 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 78 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
79 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 79 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
80 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 80 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
81 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 81 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
82 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 82 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
83 | 83 | ||
84 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 84 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
85 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 85 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
86 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 86 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
87 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 87 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
88 | 88 | ||
89 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 89 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
90 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 90 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
91 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 91 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
92 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 92 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
93 | 93 | ||
94 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 94 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
95 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 95 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
96 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 96 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
97 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 97 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
98 | 98 | ||
99 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 99 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
100 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 100 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
101 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 101 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
102 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 102 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
103 | 103 | ||
104 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 104 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
105 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 105 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
106 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 106 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
107 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 107 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
108 | 108 | ||
109 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 109 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
110 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 110 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
111 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 111 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
112 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 112 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
113 | 113 | ||
114 | KPrefs::setCurrentGroup( "BackupSettings" ); | 114 | KPrefs::setCurrentGroup( "BackupSettings" ); |
115 | addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir()); | 115 | addItemString("BackupDatadir",&mBackupDatadir,KGlobalSettings::backupDataDir()); |
116 | addItemInt( "BackupNumbers", &mBackupNumbers, 3 ); | 116 | addItemInt( "BackupNumbers", &mBackupNumbers, 3 ); |
117 | addItemInt( "BackupDayCount", &mBackupDayCount, 2 ); | 117 | addItemInt( "BackupDayCount", &mBackupDayCount, 2 ); |
118 | addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true ); | 118 | addItemBool( "BackupUseDefaultDir",&mBackupUseDefaultDir, true ); |
119 | addItemBool( "BackupEnabled",&mBackupEnabled, false ); | 119 | addItemBool( "BackupEnabled",&mBackupEnabled, false ); |
120 | 120 | ||
121 | } | 121 | } |
122 | 122 | ||
123 | void KPimGlobalPrefs::setGlobalConfig() | 123 | void KPimGlobalPrefs::setGlobalConfig() |
124 | { | 124 | { |
125 | if ( mLocaleDict == 0 ) { | 125 | if ( mLocaleDict == 0 ) { |
126 | QString fileName ; | 126 | QString fileName ; |
127 | QString name = KGlobal::getAppName() +"/"; | 127 | QString name = KGlobal::getAppName() +"/"; |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; | 129 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name; |
130 | #else | 130 | #else |
131 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | 131 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; |
132 | #endif | 132 | #endif |
133 | mLocaleDict = 0; | 133 | mLocaleDict = 0; |
134 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | 134 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { |
135 | 135 | ||
136 | if ( mPreferredLanguage == 1 ) | 136 | if ( mPreferredLanguage == 1 ) |
137 | fileName = fileName+"germantranslation.txt"; | 137 | fileName = fileName+"germantranslation.txt"; |
138 | else if ( mPreferredLanguage == 4 ) | 138 | else if ( mPreferredLanguage == 4 ) |
139 | fileName = fileName+"usertranslation.txt"; | 139 | fileName = fileName+"usertranslation.txt"; |
140 | else if ( mPreferredLanguage == 2 ) | 140 | else if ( mPreferredLanguage == 2 ) |
141 | fileName = fileName+"frenchtranslation.txt"; | 141 | fileName = fileName+"frenchtranslation.txt"; |
142 | else if ( mPreferredLanguage == 3 ) | 142 | else if ( mPreferredLanguage == 3 ) |
143 | fileName = fileName+"italiantranslation.txt"; | 143 | fileName = fileName+"italiantranslation.txt"; |
144 | QFile file( fileName ); | 144 | QFile file( fileName ); |
145 | if (file.open( IO_ReadOnly ) ) { | 145 | if (file.open( QIODevice::ReadOnly ) ) { |
146 | QTextStream ts( &file ); | 146 | Q3TextStream ts( &file ); |
147 | ts.setEncoding( QTextStream::Latin1 ); | 147 | ts.setEncoding( Q3TextStream::Latin1 ); |
148 | //ts.setCodec( QTextCodec::latin1 ); | 148 | //ts.setCodec( QTextCodec::latin1 ); |
149 | QString text = ts.read(); | 149 | QString text = ts.read(); |
150 | file.close(); | 150 | file.close(); |
151 | text.replace( QRegExp("\\\\n"), "\n" ); | 151 | text.replace( QRegExp("\\\\n"), "\n" ); |
152 | QString line; | 152 | QString line; |
153 | QString we; | 153 | QString we; |
154 | QString wt; | 154 | QString wt; |
155 | int br = 0; | 155 | int br = 0; |
156 | int nbr; | 156 | int nbr; |
157 | nbr = text.find ( "},", br ); | 157 | nbr = text.find ( "},", br ); |
158 | line = text.mid( br, nbr - br ); | 158 | line = text.mid( br, nbr - br ); |
159 | br = nbr+1; | 159 | br = nbr+1; |
160 | int se, ee, st, et; | 160 | int se, ee, st, et; |
161 | mLocaleDict = new QDict<QString>; | 161 | mLocaleDict = new Q3Dict<QString>; |
162 | mLocaleDict->setAutoDelete( true ); | 162 | mLocaleDict->setAutoDelete( true ); |
163 | QString end = "{ \"\",\"\" }"; | 163 | QString end = "{ \"\",\"\" }"; |
164 | while ( (line != end) && (br > 1) ) { | 164 | while ( (line != end) && (br > 1) ) { |
165 | //qDebug("%d *%s* ", br, line.latin1()); | 165 | //qDebug("%d *%s* ", br, line.latin1()); |
166 | se = line.find("\"")+1; | 166 | se = line.find("\"")+1; |
167 | et = line.findRev("\"",-1); | 167 | et = line.findRev("\"",-1); |
168 | ee = line.find("\",\""); | 168 | ee = line.find("\",\""); |
169 | st = ee+3; | 169 | st = ee+3; |
170 | we = line.mid( se, ee-se ); | 170 | we = line.mid( se, ee-se ); |
171 | if ( mPreferredLanguage == 4 ) | 171 | if ( mPreferredLanguage == 4 ) |
172 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); | 172 | wt = QString::fromUtf8(line.mid( st, et-st ).latin1()); |
173 | else | 173 | else |
174 | wt = line.mid( st, et-st ); | 174 | wt = line.mid( st, et-st ); |
175 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 175 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
176 | mLocaleDict->insert( we, new QString (wt) ); | 176 | mLocaleDict->insert( we, new QString (wt) ); |
177 | nbr = text.find ( "}", br ); | 177 | nbr = text.find ( "}", br ); |
178 | line = text.mid( br, nbr - br ); | 178 | line = text.mid( br, nbr - br ); |
179 | br = nbr+1; | 179 | br = nbr+1; |
180 | } | 180 | } |
181 | //qDebug("end *%s* ", end.latin1()); | 181 | //qDebug("end *%s* ", end.latin1()); |
182 | 182 | ||
183 | setLocaleDict( mLocaleDict ); | 183 | setLocaleDict( mLocaleDict ); |
184 | } else { | 184 | } else { |
185 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 185 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
190 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 190 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
191 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 191 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
192 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 192 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
193 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 193 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
194 | QString dummy = mUserDateFormatLong; | 194 | QString dummy = mUserDateFormatLong; |
195 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 195 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
196 | dummy = mUserDateFormatShort; | 196 | dummy = mUserDateFormatShort; |
197 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 197 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
198 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 198 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
199 | mDaylightsavingStart, | 199 | mDaylightsavingStart, |
200 | mDaylightsavingEnd ); | 200 | mDaylightsavingEnd ); |
201 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 201 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
202 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); | 202 | KGlobalSettings::setAlternateBackgroundColor(mAlternateColor); |
203 | QString localKdeDir; | 203 | QString localKdeDir; |
204 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | 204 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); |
205 | if ( ! localKdeDir.isEmpty() ) { | 205 | if ( ! localKdeDir.isEmpty() ) { |
206 | mBackupUseDefaultDir = true; | 206 | mBackupUseDefaultDir = true; |
207 | mBackupDatadir = KGlobalSettings::backupDataDir(); | 207 | mBackupDatadir = KGlobalSettings::backupDataDir(); |
208 | } | 208 | } |
209 | 209 | ||
210 | } | 210 | } |
211 | KPimGlobalPrefs::~KPimGlobalPrefs() | 211 | KPimGlobalPrefs::~KPimGlobalPrefs() |
212 | { | 212 | { |
213 | if (sInstance == this) | 213 | if (sInstance == this) |
214 | sInstance = staticDeleterGP.setObject(0); | 214 | sInstance = staticDeleterGP.setObject(0); |
215 | else | 215 | else |
216 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | 216 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); |
217 | if ( mLocaleDict ) | 217 | if ( mLocaleDict ) |
218 | delete mLocaleDict; | 218 | delete mLocaleDict; |
219 | } | 219 | } |
220 | 220 | ||
221 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 221 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
222 | { | 222 | { |
223 | if ( !sInstance ) { | 223 | if ( !sInstance ) { |
224 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); | 224 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
225 | sInstance->readConfig(); | 225 | sInstance->readConfig(); |
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h index 94ac8ae..01f5ab0 100644 --- a/libkdepim/kpimglobalprefs.h +++ b/libkdepim/kpimglobalprefs.h | |||
@@ -1,151 +1,151 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef KPIMGLOBALPREFS_H | 31 | #ifndef KPIMGLOBALPREFS_H |
32 | #define KPIMGLOBALPREFS_H | 32 | #define KPIMGLOBALPREFS_H |
33 | 33 | ||
34 | #include "kprefs.h" | 34 | #include "kprefs.h" |
35 | #include <qdict.h> | 35 | #include <q3dict.h> |
36 | 36 | ||
37 | class KPimGlobalPrefs : public KPrefs | 37 | class KPimGlobalPrefs : public KPrefs |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | 40 | ||
41 | void setGlobalConfig(); | 41 | void setGlobalConfig(); |
42 | static KPimGlobalPrefs *instance(); | 42 | static KPimGlobalPrefs *instance(); |
43 | 43 | ||
44 | 44 | ||
45 | virtual ~KPimGlobalPrefs(); | 45 | virtual ~KPimGlobalPrefs(); |
46 | 46 | ||
47 | 47 | ||
48 | enum EMailClients { | 48 | enum EMailClients { |
49 | NONE_EMC = 0, | 49 | NONE_EMC = 0, |
50 | OTHER_EMC = 1, | 50 | OTHER_EMC = 1, |
51 | OMPI_EMC = 2, | 51 | OMPI_EMC = 2, |
52 | QTOPIA_EMC = 3, | 52 | QTOPIA_EMC = 3, |
53 | OPIE_EMC = 4, | 53 | OPIE_EMC = 4, |
54 | OPIE_MAILIT_EMC = 5 | 54 | OPIE_MAILIT_EMC = 5 |
55 | }; | 55 | }; |
56 | 56 | ||
57 | enum PhoneClients { | 57 | enum PhoneClients { |
58 | NONE_PHC = 0, | 58 | NONE_PHC = 0, |
59 | OTHER_PHC = 1, | 59 | OTHER_PHC = 1, |
60 | KPPI_PHC = 2 | 60 | KPPI_PHC = 2 |
61 | }; | 61 | }; |
62 | 62 | ||
63 | enum FaxClients { | 63 | enum FaxClients { |
64 | NONE_FAC = 0, | 64 | NONE_FAC = 0, |
65 | OTHER_FAC = 1 | 65 | OTHER_FAC = 1 |
66 | }; | 66 | }; |
67 | 67 | ||
68 | enum SMSClients { | 68 | enum SMSClients { |
69 | NONE_SMC = 0, | 69 | NONE_SMC = 0, |
70 | OTHER_SMC = 1 | 70 | OTHER_SMC = 1 |
71 | }; | 71 | }; |
72 | 72 | ||
73 | enum PagerClients { | 73 | enum PagerClients { |
74 | NONE_PAC = 0, | 74 | NONE_PAC = 0, |
75 | OTHER_PAC = 1 | 75 | OTHER_PAC = 1 |
76 | }; | 76 | }; |
77 | 77 | ||
78 | enum SIPClients { | 78 | enum SIPClients { |
79 | NONE_SIC = 0, | 79 | NONE_SIC = 0, |
80 | OTHER_SIC = 1, | 80 | OTHER_SIC = 1, |
81 | KPPI_SIC = 2 | 81 | KPPI_SIC = 2 |
82 | }; | 82 | }; |
83 | 83 | ||
84 | private: | 84 | private: |
85 | KPimGlobalPrefs( const QString &name = QString::null ); | 85 | KPimGlobalPrefs( const QString &name = QString::null ); |
86 | 86 | ||
87 | static KPimGlobalPrefs *sInstance; | 87 | static KPimGlobalPrefs *sInstance; |
88 | QDict<QString> *mLocaleDict; | 88 | Q3Dict<QString> *mLocaleDict; |
89 | 89 | ||
90 | 90 | ||
91 | public: | 91 | public: |
92 | //US I copied the following "locale" settings from KOPrefs | 92 | //US I copied the following "locale" settings from KOPrefs |
93 | int mPreferredDate; | 93 | int mPreferredDate; |
94 | QString mUserDateFormatLong; | 94 | QString mUserDateFormatLong; |
95 | QString mUserDateFormatShort; | 95 | QString mUserDateFormatShort; |
96 | int mPreferredLanguage; | 96 | int mPreferredLanguage; |
97 | int mPreferredTime; | 97 | int mPreferredTime; |
98 | bool mWeekStartsOnSunday; | 98 | bool mWeekStartsOnSunday; |
99 | QString mTimeZoneId; | 99 | QString mTimeZoneId; |
100 | bool mUseDaylightsaving; | 100 | bool mUseDaylightsaving; |
101 | int mDaylightsavingStart; | 101 | int mDaylightsavingStart; |
102 | int mDaylightsavingEnd; | 102 | int mDaylightsavingEnd; |
103 | bool mTimeZoneAdd30min; | 103 | bool mTimeZoneAdd30min; |
104 | QFont mApplicationFont; | 104 | QFont mApplicationFont; |
105 | QColor mAlternateColor; | 105 | QColor mAlternateColor; |
106 | 106 | ||
107 | int mEmailClient; | 107 | int mEmailClient; |
108 | QString mEmailOtherChannel; | 108 | QString mEmailOtherChannel; |
109 | QString mEmailOtherMessage; | 109 | QString mEmailOtherMessage; |
110 | QString mEmailOtherMessageParameters; | 110 | QString mEmailOtherMessageParameters; |
111 | QString mEmailOtherMessage2; | 111 | QString mEmailOtherMessage2; |
112 | QString mEmailOtherMessageParameters2; | 112 | QString mEmailOtherMessageParameters2; |
113 | 113 | ||
114 | int mPhoneClient; | 114 | int mPhoneClient; |
115 | QString mPhoneOtherChannel; | 115 | QString mPhoneOtherChannel; |
116 | QString mPhoneOtherMessage; | 116 | QString mPhoneOtherMessage; |
117 | QString mPhoneOtherMessageParameters; | 117 | QString mPhoneOtherMessageParameters; |
118 | 118 | ||
119 | int mFaxClient; | 119 | int mFaxClient; |
120 | QString mFaxOtherChannel; | 120 | QString mFaxOtherChannel; |
121 | QString mFaxOtherMessage; | 121 | QString mFaxOtherMessage; |
122 | QString mFaxOtherMessageParameters; | 122 | QString mFaxOtherMessageParameters; |
123 | 123 | ||
124 | int mSMSClient; | 124 | int mSMSClient; |
125 | QString mSMSOtherChannel; | 125 | QString mSMSOtherChannel; |
126 | QString mSMSOtherMessage; | 126 | QString mSMSOtherMessage; |
127 | QString mSMSOtherMessageParameters; | 127 | QString mSMSOtherMessageParameters; |
128 | 128 | ||
129 | int mPagerClient; | 129 | int mPagerClient; |
130 | QString mPagerOtherChannel; | 130 | QString mPagerOtherChannel; |
131 | QString mPagerOtherMessage; | 131 | QString mPagerOtherMessage; |
132 | QString mPagerOtherMessageParameters; | 132 | QString mPagerOtherMessageParameters; |
133 | 133 | ||
134 | int mSipClient; | 134 | int mSipClient; |
135 | QString mSipOtherChannel; | 135 | QString mSipOtherChannel; |
136 | QString mSipOtherMessage; | 136 | QString mSipOtherMessage; |
137 | QString mSipOtherMessageParameters; | 137 | QString mSipOtherMessageParameters; |
138 | 138 | ||
139 | QString mEx2PhoneDevice; | 139 | QString mEx2PhoneDevice; |
140 | QString mEx2PhoneConnection; | 140 | QString mEx2PhoneConnection; |
141 | QString mEx2PhoneModel; | 141 | QString mEx2PhoneModel; |
142 | 142 | ||
143 | 143 | ||
144 | bool mBackupEnabled; | 144 | bool mBackupEnabled; |
145 | QString mBackupDatadir; | 145 | QString mBackupDatadir; |
146 | bool mBackupUseDefaultDir; | 146 | bool mBackupUseDefaultDir; |
147 | int mBackupNumbers; | 147 | int mBackupNumbers; |
148 | int mBackupDayCount; | 148 | int mBackupDayCount; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | #endif | 151 | #endif |
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index 6dc741d..358acbd 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -1,291 +1,292 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <q3groupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <q3buttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <q3textstream.h> |
35 | #include <qvbox.h> | 35 | #include <q3vbox.h> |
36 | #include <qhbox.h> | 36 | #include <q3hbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <q3frame.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | #include <QDesktopWidget> | ||
45 | 46 | ||
46 | #include <kcolorbutton.h> | 47 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 48 | #include <kdebug.h> |
48 | #include <klocale.h> | 49 | #include <klocale.h> |
49 | #include <kglobal.h> | 50 | #include <kglobal.h> |
50 | #include <kglobalsettings.h> | 51 | #include <kglobalsettings.h> |
51 | #include <kfontdialog.h> | 52 | #include <kfontdialog.h> |
52 | #include <kmessagebox.h> | 53 | #include <kmessagebox.h> |
53 | #include <kcolordialog.h> | 54 | #include <kcolordialog.h> |
54 | #include <kiconloader.h> | 55 | #include <kiconloader.h> |
55 | 56 | ||
56 | #include "kprefs.h" | 57 | #include "kprefs.h" |
57 | #include "kpimglobalprefs.h" | 58 | #include "kpimglobalprefs.h" |
58 | 59 | ||
59 | #include "kprefsdialog.h" | 60 | #include "kprefsdialog.h" |
60 | //#include "kprefsdialog.moc" | 61 | //#include "kprefsdialog.moc" |
61 | 62 | ||
62 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, | 63 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, |
63 | QWidget *parent) | 64 | QWidget *parent) |
64 | { | 65 | { |
65 | mReference = reference; | 66 | mReference = reference; |
66 | 67 | ||
67 | mCheck = new QCheckBox(text,parent); | 68 | mCheck = new QCheckBox(text,parent); |
68 | } | 69 | } |
69 | 70 | ||
70 | void KPrefsDialogWidBool::readConfig() | 71 | void KPrefsDialogWidBool::readConfig() |
71 | { | 72 | { |
72 | mCheck->setChecked(*mReference); | 73 | mCheck->setChecked(*mReference); |
73 | } | 74 | } |
74 | 75 | ||
75 | void KPrefsDialogWidBool::writeConfig() | 76 | void KPrefsDialogWidBool::writeConfig() |
76 | { | 77 | { |
77 | *mReference = mCheck->isChecked(); | 78 | *mReference = mCheck->isChecked(); |
78 | } | 79 | } |
79 | 80 | ||
80 | QCheckBox *KPrefsDialogWidBool::checkBox() | 81 | QCheckBox *KPrefsDialogWidBool::checkBox() |
81 | { | 82 | { |
82 | return mCheck; | 83 | return mCheck; |
83 | } | 84 | } |
84 | 85 | ||
85 | 86 | ||
86 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, | 87 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, |
87 | QWidget *parent) | 88 | QWidget *parent) |
88 | { | 89 | { |
89 | mReference = reference; | 90 | mReference = reference; |
90 | 91 | ||
91 | mButton = new KColorButton(parent); | 92 | mButton = new KColorButton(parent); |
92 | mLabel = new QLabel(mButton, text, parent); | 93 | mLabel = new QLabel(mButton, text, parent); |
93 | mButton->setColor( *mReference ); | 94 | mButton->setColor( *mReference ); |
94 | mButton->setColor( Qt::red ); | 95 | mButton->setColor( Qt::red ); |
95 | 96 | ||
96 | } | 97 | } |
97 | 98 | ||
98 | KPrefsDialogWidColor::~KPrefsDialogWidColor() | 99 | KPrefsDialogWidColor::~KPrefsDialogWidColor() |
99 | { | 100 | { |
100 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; | 101 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; |
101 | } | 102 | } |
102 | 103 | ||
103 | void KPrefsDialogWidColor::readConfig() | 104 | void KPrefsDialogWidColor::readConfig() |
104 | { | 105 | { |
105 | mButton->setColor(*mReference); | 106 | mButton->setColor(*mReference); |
106 | } | 107 | } |
107 | 108 | ||
108 | void KPrefsDialogWidColor::writeConfig() | 109 | void KPrefsDialogWidColor::writeConfig() |
109 | { | 110 | { |
110 | *mReference = mButton->color(); | 111 | *mReference = mButton->color(); |
111 | } | 112 | } |
112 | 113 | ||
113 | QLabel *KPrefsDialogWidColor::label() | 114 | QLabel *KPrefsDialogWidColor::label() |
114 | { | 115 | { |
115 | return mLabel; | 116 | return mLabel; |
116 | } | 117 | } |
117 | 118 | ||
118 | KColorButton *KPrefsDialogWidColor::button() | 119 | KColorButton *KPrefsDialogWidColor::button() |
119 | { | 120 | { |
120 | return mButton; | 121 | return mButton; |
121 | } | 122 | } |
122 | 123 | ||
123 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 124 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
124 | QFont *reference,QWidget *parent) | 125 | QFont *reference,QWidget *parent) |
125 | { | 126 | { |
126 | mReference = reference; | 127 | mReference = reference; |
127 | 128 | ||
128 | mLabel = new QLabel(labelText, parent); | 129 | mLabel = new QLabel(labelText, parent); |
129 | 130 | ||
130 | mPreview = new QLabel(sampleText,parent); | 131 | mPreview = new QLabel(sampleText,parent); |
131 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 132 | mPreview->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken); |
132 | 133 | ||
133 | mButton = new QPushButton(i18n("Choose..."), parent); | 134 | mButton = new QPushButton(i18n("Choose..."), parent); |
134 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 135 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
135 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 136 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
136 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 137 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
137 | } | 138 | } |
138 | 139 | ||
139 | KPrefsDialogWidFont::~KPrefsDialogWidFont() | 140 | KPrefsDialogWidFont::~KPrefsDialogWidFont() |
140 | { | 141 | { |
141 | } | 142 | } |
142 | 143 | ||
143 | void KPrefsDialogWidFont::readConfig() | 144 | void KPrefsDialogWidFont::readConfig() |
144 | { | 145 | { |
145 | mPreview->setFont(*mReference); | 146 | mPreview->setFont(*mReference); |
146 | } | 147 | } |
147 | 148 | ||
148 | void KPrefsDialogWidFont::writeConfig() | 149 | void KPrefsDialogWidFont::writeConfig() |
149 | { | 150 | { |
150 | *mReference = mPreview->font(); | 151 | *mReference = mPreview->font(); |
151 | } | 152 | } |
152 | 153 | ||
153 | QLabel *KPrefsDialogWidFont::label() | 154 | QLabel *KPrefsDialogWidFont::label() |
154 | { | 155 | { |
155 | return mLabel; | 156 | return mLabel; |
156 | } | 157 | } |
157 | 158 | ||
158 | QLabel *KPrefsDialogWidFont::preview() | 159 | QLabel *KPrefsDialogWidFont::preview() |
159 | { | 160 | { |
160 | return mPreview; | 161 | return mPreview; |
161 | } | 162 | } |
162 | 163 | ||
163 | QPushButton *KPrefsDialogWidFont::button() | 164 | QPushButton *KPrefsDialogWidFont::button() |
164 | { | 165 | { |
165 | return mButton; | 166 | return mButton; |
166 | } | 167 | } |
167 | 168 | ||
168 | void KPrefsDialogWidFont::selectFont() | 169 | void KPrefsDialogWidFont::selectFont() |
169 | { | 170 | { |
170 | QFont myFont(mPreview->font()); | 171 | QFont myFont(mPreview->font()); |
171 | bool ok; | 172 | bool ok; |
172 | myFont = KFontDialog::getFont(myFont, ok); | 173 | myFont = KFontDialog::getFont(myFont, ok); |
173 | if ( ok ) { | 174 | if ( ok ) { |
174 | mPreview->setFont(myFont); | 175 | mPreview->setFont(myFont); |
175 | } | 176 | } |
176 | } | 177 | } |
177 | 178 | ||
178 | 179 | ||
179 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, | 180 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, |
180 | QWidget *parent) | 181 | QWidget *parent) |
181 | { | 182 | { |
182 | mReference = reference; | 183 | mReference = reference; |
183 | 184 | ||
184 | mLabel = new QLabel(text,parent); | 185 | mLabel = new QLabel(text,parent); |
185 | mSpin = new QSpinBox(0,23,1,parent); | 186 | mSpin = new QSpinBox(0,23,1,parent); |
186 | mSpin->setSuffix(":00"); | 187 | mSpin->setSuffix(":00"); |
187 | } | 188 | } |
188 | 189 | ||
189 | void KPrefsDialogWidTime::readConfig() | 190 | void KPrefsDialogWidTime::readConfig() |
190 | { | 191 | { |
191 | mSpin->setValue(*mReference); | 192 | mSpin->setValue(*mReference); |
192 | } | 193 | } |
193 | 194 | ||
194 | void KPrefsDialogWidTime::writeConfig() | 195 | void KPrefsDialogWidTime::writeConfig() |
195 | { | 196 | { |
196 | *mReference = mSpin->value(); | 197 | *mReference = mSpin->value(); |
197 | } | 198 | } |
198 | 199 | ||
199 | QLabel *KPrefsDialogWidTime::label() | 200 | QLabel *KPrefsDialogWidTime::label() |
200 | { | 201 | { |
201 | return mLabel; | 202 | return mLabel; |
202 | } | 203 | } |
203 | 204 | ||
204 | QSpinBox *KPrefsDialogWidTime::spinBox() | 205 | QSpinBox *KPrefsDialogWidTime::spinBox() |
205 | { | 206 | { |
206 | return mSpin; | 207 | return mSpin; |
207 | } | 208 | } |
208 | 209 | ||
209 | 210 | ||
210 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, | 211 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, |
211 | QWidget *parent) | 212 | QWidget *parent) |
212 | { | 213 | { |
213 | mReference = reference; | 214 | mReference = reference; |
214 | 215 | ||
215 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 216 | mBox = new Q3ButtonGroup(1,Qt::Horizontal,text,parent); |
216 | } | 217 | } |
217 | 218 | ||
218 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() | 219 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() |
219 | { | 220 | { |
220 | } | 221 | } |
221 | 222 | ||
222 | void KPrefsDialogWidRadios::addRadio(const QString &text) | 223 | void KPrefsDialogWidRadios::addRadio(const QString &text) |
223 | { | 224 | { |
224 | new QRadioButton(text,mBox); | 225 | new QRadioButton(text,mBox); |
225 | } | 226 | } |
226 | 227 | ||
227 | QButtonGroup *KPrefsDialogWidRadios::groupBox() | 228 | Q3ButtonGroup *KPrefsDialogWidRadios::groupBox() |
228 | { | 229 | { |
229 | return mBox; | 230 | return mBox; |
230 | } | 231 | } |
231 | 232 | ||
232 | void KPrefsDialogWidRadios::readConfig() | 233 | void KPrefsDialogWidRadios::readConfig() |
233 | { | 234 | { |
234 | mBox->setButton(*mReference); | 235 | mBox->setButton(*mReference); |
235 | } | 236 | } |
236 | 237 | ||
237 | void KPrefsDialogWidRadios::writeConfig() | 238 | void KPrefsDialogWidRadios::writeConfig() |
238 | { | 239 | { |
239 | *mReference = mBox->id(mBox->selected()); | 240 | *mReference = mBox->id(mBox->selected()); |
240 | } | 241 | } |
241 | 242 | ||
242 | 243 | ||
243 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, | 244 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, |
244 | QWidget *parent, QLineEdit::EchoMode echomode) | 245 | QWidget *parent, QLineEdit::EchoMode echomode) |
245 | { | 246 | { |
246 | mReference = reference; | 247 | mReference = reference; |
247 | 248 | ||
248 | mLabel = new QLabel(text,parent); | 249 | mLabel = new QLabel(text,parent); |
249 | mEdit = new QLineEdit(parent); | 250 | mEdit = new QLineEdit(parent); |
250 | mEdit->setEchoMode( echomode ); | 251 | mEdit->setEchoMode( echomode ); |
251 | } | 252 | } |
252 | 253 | ||
253 | KPrefsDialogWidString::~KPrefsDialogWidString() | 254 | KPrefsDialogWidString::~KPrefsDialogWidString() |
254 | { | 255 | { |
255 | } | 256 | } |
256 | 257 | ||
257 | void KPrefsDialogWidString::readConfig() | 258 | void KPrefsDialogWidString::readConfig() |
258 | { | 259 | { |
259 | mEdit->setText(*mReference); | 260 | mEdit->setText(*mReference); |
260 | } | 261 | } |
261 | 262 | ||
262 | void KPrefsDialogWidString::writeConfig() | 263 | void KPrefsDialogWidString::writeConfig() |
263 | { | 264 | { |
264 | *mReference = mEdit->text(); | 265 | *mReference = mEdit->text(); |
265 | } | 266 | } |
266 | 267 | ||
267 | QLabel *KPrefsDialogWidString::label() | 268 | QLabel *KPrefsDialogWidString::label() |
268 | { | 269 | { |
269 | return mLabel; | 270 | return mLabel; |
270 | } | 271 | } |
271 | 272 | ||
272 | QLineEdit *KPrefsDialogWidString::lineEdit() | 273 | QLineEdit *KPrefsDialogWidString::lineEdit() |
273 | { | 274 | { |
274 | return mEdit; | 275 | return mEdit; |
275 | } | 276 | } |
276 | 277 | ||
277 | 278 | ||
278 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : | 279 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : |
279 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, | 280 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, |
280 | name,modal,true) | 281 | name,modal,true) |
281 | { | 282 | { |
282 | mPrefs = prefs; | 283 | mPrefs = prefs; |
283 | 284 | ||
284 | // This seems to cause a crash on exit. Investigate later. | 285 | // This seems to cause a crash on exit. Investigate later. |
285 | mPrefsWids.setAutoDelete(true); | 286 | mPrefsWids.setAutoDelete(true); |
286 | 287 | ||
287 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); | 288 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); |
288 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); | 289 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); |
289 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 290 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
290 | } | 291 | } |
291 | 292 | ||
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index 52ec809..cc95dd4 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -1,103 +1,105 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 _KPREFSDIALOG_H | 23 | #ifndef _KPREFSDIALOG_H |
24 | #define _KPREFSDIALOG_H | 24 | #define _KPREFSDIALOG_H |
25 | // $Id$ | 25 | // $Id$ |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | //Added by qt3to4: | ||
30 | #include <QLabel> | ||
29 | 31 | ||
30 | #include <kdialogbase.h> | 32 | #include <kdialogbase.h> |
31 | 33 | ||
32 | class KPrefs; | 34 | class KPrefs; |
33 | class KPrefsDialog; | 35 | class KPrefsDialog; |
34 | 36 | ||
35 | class KColorButton; | 37 | class KColorButton; |
36 | class QCheckBox; | 38 | class QCheckBox; |
37 | class QLabel; | 39 | class QLabel; |
38 | class QSpinBox; | 40 | class QSpinBox; |
39 | class QButtonGroup; | 41 | class Q3ButtonGroup; |
40 | 42 | ||
41 | /** | 43 | /** |
42 | @short Base class for widgets used by @ref KPrefsDialog. | 44 | @short Base class for widgets used by @ref KPrefsDialog. |
43 | @author Cornelius Schumacher | 45 | @author Cornelius Schumacher |
44 | @see KPrefsDialog | 46 | @see KPrefsDialog |
45 | 47 | ||
46 | This class provides the interface for the preferences widgets used by | 48 | This class provides the interface for the preferences widgets used by |
47 | KPrefsDialog. | 49 | KPrefsDialog. |
48 | */ | 50 | */ |
49 | class KPrefsDialogWid : public QObject | 51 | class KPrefsDialogWid : public QObject |
50 | { | 52 | { |
51 | public: | 53 | public: |
52 | /** | 54 | /** |
53 | This function is called to read value of the setting from the | 55 | This function is called to read value of the setting from the |
54 | stored configuration and display it in the widget. | 56 | stored configuration and display it in the widget. |
55 | */ | 57 | */ |
56 | virtual void readConfig() = 0; | 58 | virtual void readConfig() = 0; |
57 | /** | 59 | /** |
58 | This function is called to write the current setting of the widget to the | 60 | This function is called to write the current setting of the widget to the |
59 | stored configuration. | 61 | stored configuration. |
60 | */ | 62 | */ |
61 | virtual void writeConfig() = 0; | 63 | virtual void writeConfig() = 0; |
62 | }; | 64 | }; |
63 | 65 | ||
64 | /** | 66 | /** |
65 | @short Widget for bool settings in @ref KPrefsDialog. | 67 | @short Widget for bool settings in @ref KPrefsDialog. |
66 | 68 | ||
67 | This class provides a widget for configuring bool values. It is meant to be | 69 | This class provides a widget for configuring bool values. It is meant to be |
68 | used by KPrefsDialog. The user is responsible for the layout management. | 70 | used by KPrefsDialog. The user is responsible for the layout management. |
69 | */ | 71 | */ |
70 | class KPrefsDialogWidBool : public KPrefsDialogWid | 72 | class KPrefsDialogWidBool : public KPrefsDialogWid |
71 | { | 73 | { |
72 | public: | 74 | public: |
73 | /** | 75 | /** |
74 | Create a bool widget consisting of a QCheckbox. | 76 | Create a bool widget consisting of a QCheckbox. |
75 | 77 | ||
76 | @param text Text of QCheckBox. | 78 | @param text Text of QCheckBox. |
77 | @param reference Pointer to variable read and written by this widget. | 79 | @param reference Pointer to variable read and written by this widget. |
78 | @param parent Parent widget. | 80 | @param parent Parent widget. |
79 | */ | 81 | */ |
80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); | 82 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); |
81 | 83 | ||
82 | /** | 84 | /** |
83 | Return the QCheckbox used by this widget. | 85 | Return the QCheckbox used by this widget. |
84 | */ | 86 | */ |
85 | QCheckBox *checkBox(); | 87 | QCheckBox *checkBox(); |
86 | 88 | ||
87 | void readConfig(); | 89 | void readConfig(); |
88 | void writeConfig(); | 90 | void writeConfig(); |
89 | 91 | ||
90 | private: | 92 | private: |
91 | bool *mReference; | 93 | bool *mReference; |
92 | 94 | ||
93 | QCheckBox *mCheck; | 95 | QCheckBox *mCheck; |
94 | }; | 96 | }; |
95 | 97 | ||
96 | /** | 98 | /** |
97 | @short Widget for time settings in @ref KPrefsDialog. | 99 | @short Widget for time settings in @ref KPrefsDialog. |
98 | 100 | ||
99 | This class provides a widget for configuring time values. It is meant to be | 101 | This class provides a widget for configuring time values. It is meant to be |
100 | used by KPrefsDialog. The user is responsible for the layout management. | 102 | used by KPrefsDialog. The user is responsible for the layout management. |
101 | */ | 103 | */ |
102 | class KPrefsDialogWidTime : public KPrefsDialogWid | 104 | class KPrefsDialogWidTime : public KPrefsDialogWid |
103 | { | 105 | { |
@@ -197,137 +199,137 @@ class KPrefsDialogWidFont : public KPrefsDialogWid | |||
197 | */ | 199 | */ |
198 | ~KPrefsDialogWidFont(); | 200 | ~KPrefsDialogWidFont(); |
199 | 201 | ||
200 | /** | 202 | /** |
201 | Return label. | 203 | Return label. |
202 | */ | 204 | */ |
203 | QLabel *label(); | 205 | QLabel *label(); |
204 | /** | 206 | /** |
205 | Return QFrame used as preview field. | 207 | Return QFrame used as preview field. |
206 | */ | 208 | */ |
207 | QLabel *preview(); | 209 | QLabel *preview(); |
208 | /** | 210 | /** |
209 | Return button opening the font dialog. | 211 | Return button opening the font dialog. |
210 | */ | 212 | */ |
211 | QPushButton *button(); | 213 | QPushButton *button(); |
212 | 214 | ||
213 | void readConfig(); | 215 | void readConfig(); |
214 | void writeConfig(); | 216 | void writeConfig(); |
215 | 217 | ||
216 | protected slots: | 218 | protected slots: |
217 | void selectFont(); | 219 | void selectFont(); |
218 | 220 | ||
219 | private: | 221 | private: |
220 | QFont *mReference; | 222 | QFont *mReference; |
221 | 223 | ||
222 | QLabel *mLabel; | 224 | QLabel *mLabel; |
223 | QLabel *mPreview; | 225 | QLabel *mPreview; |
224 | QPushButton *mButton; | 226 | QPushButton *mButton; |
225 | }; | 227 | }; |
226 | 228 | ||
227 | /** | 229 | /** |
228 | @short Widget for settings represented by a group of radio buttons in | 230 | @short Widget for settings represented by a group of radio buttons in |
229 | @ref KPrefsDialog. | 231 | @ref KPrefsDialog. |
230 | 232 | ||
231 | This class provides a widget for configuring selections. It is meant to be | 233 | This class provides a widget for configuring selections. It is meant to be |
232 | used by KPrefsDialog. The user is responsible for the layout management. The | 234 | used by KPrefsDialog. The user is responsible for the layout management. The |
233 | setting is interpreted as an int value, corresponding to the position of the | 235 | setting is interpreted as an int value, corresponding to the position of the |
234 | radio button. The position of the button is defined by the sequence of @ref | 236 | radio button. The position of the button is defined by the sequence of @ref |
235 | addRadio() calls, starting with 0. | 237 | addRadio() calls, starting with 0. |
236 | */ | 238 | */ |
237 | class KPrefsDialogWidRadios : public KPrefsDialogWid | 239 | class KPrefsDialogWidRadios : public KPrefsDialogWid |
238 | { | 240 | { |
239 | public: | 241 | public: |
240 | /** | 242 | /** |
241 | Create a widget for selection of an option. It consists of a box with | 243 | Create a widget for selection of an option. It consists of a box with |
242 | several radio buttons. | 244 | several radio buttons. |
243 | 245 | ||
244 | @param text Text of main box. | 246 | @param text Text of main box. |
245 | @param reference Pointer to variable read and written by this widget. | 247 | @param reference Pointer to variable read and written by this widget. |
246 | @param parent Parent widget. | 248 | @param parent Parent widget. |
247 | */ | 249 | */ |
248 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); | 250 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); |
249 | virtual ~KPrefsDialogWidRadios(); | 251 | virtual ~KPrefsDialogWidRadios(); |
250 | 252 | ||
251 | /** | 253 | /** |
252 | Add a radio button. | 254 | Add a radio button. |
253 | 255 | ||
254 | @param text Text of the button. | 256 | @param text Text of the button. |
255 | */ | 257 | */ |
256 | void addRadio(const QString &text); | 258 | void addRadio(const QString &text); |
257 | 259 | ||
258 | /** | 260 | /** |
259 | Return the box widget used by this widget. | 261 | Return the box widget used by this widget. |
260 | */ | 262 | */ |
261 | QButtonGroup *groupBox(); | 263 | Q3ButtonGroup *groupBox(); |
262 | 264 | ||
263 | void readConfig(); | 265 | void readConfig(); |
264 | void writeConfig(); | 266 | void writeConfig(); |
265 | 267 | ||
266 | private: | 268 | private: |
267 | int *mReference; | 269 | int *mReference; |
268 | 270 | ||
269 | QButtonGroup *mBox; | 271 | Q3ButtonGroup *mBox; |
270 | }; | 272 | }; |
271 | 273 | ||
272 | 274 | ||
273 | /** | 275 | /** |
274 | @short Widget for string settings in @ref KPrefsDialog. | 276 | @short Widget for string settings in @ref KPrefsDialog. |
275 | 277 | ||
276 | This class provides a widget for configuring string values. It is meant to be | 278 | This class provides a widget for configuring string values. It is meant to be |
277 | used by KPrefsDialog. The user is responsible for the layout management. | 279 | used by KPrefsDialog. The user is responsible for the layout management. |
278 | */ | 280 | */ |
279 | class KPrefsDialogWidString : public KPrefsDialogWid | 281 | class KPrefsDialogWidString : public KPrefsDialogWid |
280 | { | 282 | { |
281 | public: | 283 | public: |
282 | /** | 284 | /** |
283 | Create a string widget consisting of a test label and a line edit. | 285 | Create a string widget consisting of a test label and a line edit. |
284 | 286 | ||
285 | @param text Text of label. | 287 | @param text Text of label. |
286 | @param reference Pointer to variable read and written by this widget. | 288 | @param reference Pointer to variable read and written by this widget. |
287 | @param parent Parent widget. | 289 | @param parent Parent widget. |
288 | */ | 290 | */ |
289 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); | 291 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); |
290 | /** | 292 | /** |
291 | Destructor. | 293 | Destructor. |
292 | */ | 294 | */ |
293 | virtual ~KPrefsDialogWidString(); | 295 | virtual ~KPrefsDialogWidString(); |
294 | 296 | ||
295 | /** | 297 | /** |
296 | Return label used by this widget. | 298 | Return label used by this widget. |
297 | */ | 299 | */ |
298 | QLabel *label(); | 300 | QLabel *label(); |
299 | /** | 301 | /** |
300 | Return QLineEdit used by this widget. | 302 | Return QLineEdit used by this widget. |
301 | */ | 303 | */ |
302 | QLineEdit *lineEdit(); | 304 | QLineEdit *lineEdit(); |
303 | 305 | ||
304 | void readConfig(); | 306 | void readConfig(); |
305 | void writeConfig(); | 307 | void writeConfig(); |
306 | 308 | ||
307 | private: | 309 | private: |
308 | QString *mReference; | 310 | QString *mReference; |
309 | 311 | ||
310 | QLabel *mLabel; | 312 | QLabel *mLabel; |
311 | QLineEdit *mEdit; | 313 | QLineEdit *mEdit; |
312 | }; | 314 | }; |
313 | 315 | ||
314 | 316 | ||
315 | /** | 317 | /** |
316 | @short Base class for a preferences dialog. | 318 | @short Base class for a preferences dialog. |
317 | 319 | ||
318 | This class provides the framework for a preferences dialog. You have to | 320 | This class provides the framework for a preferences dialog. You have to |
319 | subclass it and add the code to create the actual configuration widgets and | 321 | subclass it and add the code to create the actual configuration widgets and |
320 | do the layout management. | 322 | do the layout management. |
321 | 323 | ||
322 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For | 324 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For |
323 | these widgets the reading, writing and setting to default values is handled | 325 | these widgets the reading, writing and setting to default values is handled |
324 | automatically. Custom widgets have to be handled in the functions @ref | 326 | automatically. Custom widgets have to be handled in the functions @ref |
325 | usrReadConfig() and @ref usrWriteConfig(). | 327 | usrReadConfig() and @ref usrWriteConfig(). |
326 | */ | 328 | */ |
327 | class KPrefsDialog : public KDialogBase | 329 | class KPrefsDialog : public KDialogBase |
328 | { | 330 | { |
329 | Q_OBJECT | 331 | Q_OBJECT |
330 | public: | 332 | public: |
331 | /** | 333 | /** |
332 | Create a KPrefsDialog for a KPrefs object. | 334 | Create a KPrefsDialog for a KPrefs object. |
333 | 335 | ||
@@ -378,94 +380,94 @@ class KPrefsDialog : public KDialogBase | |||
378 | @param parent Parent widget. | 380 | @param parent Parent widget. |
379 | */ | 381 | */ |
380 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); | 382 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); |
381 | /** | 383 | /** |
382 | Register a @ref KPrefsDialogWidString object. | 384 | Register a @ref KPrefsDialogWidString object. |
383 | 385 | ||
384 | @param text Text of string widget. | 386 | @param text Text of string widget. |
385 | @param reference Reference to variable storing the setting. | 387 | @param reference Reference to variable storing the setting. |
386 | @param parent Parent widget. | 388 | @param parent Parent widget. |
387 | */ | 389 | */ |
388 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); | 390 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); |
389 | /** | 391 | /** |
390 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. | 392 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. |
391 | 393 | ||
392 | @param text Text of string widget. | 394 | @param text Text of string widget. |
393 | @param reference Reference to variable storing the setting. | 395 | @param reference Reference to variable storing the setting. |
394 | @param parent Parent widget. | 396 | @param parent Parent widget. |
395 | */ | 397 | */ |
396 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); | 398 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); |
397 | /** | 399 | /** |
398 | Register a @ref KPrefsDialogWidFont object. | 400 | Register a @ref KPrefsDialogWidFont object. |
399 | 401 | ||
400 | @param sampleText Sample text of font widget. | 402 | @param sampleText Sample text of font widget. |
401 | @param buttonText Button text of font widget. | 403 | @param buttonText Button text of font widget. |
402 | @param reference Reference to variable storing the setting. | 404 | @param reference Reference to variable storing the setting. |
403 | @param parent Parent widget. | 405 | @param parent Parent widget. |
404 | */ | 406 | */ |
405 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, | 407 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, |
406 | QFont *reference,QWidget *parent); | 408 | QFont *reference,QWidget *parent); |
407 | 409 | ||
408 | public slots: | 410 | public slots: |
409 | /** Set all widgets to default values. */ | 411 | /** Set all widgets to default values. */ |
410 | void setDefaults(); | 412 | void setDefaults(); |
411 | 413 | ||
412 | /** Read preferences from config file. */ | 414 | /** Read preferences from config file. */ |
413 | void readConfig(); | 415 | void readConfig(); |
414 | 416 | ||
415 | /** Write preferences to config file. */ | 417 | /** Write preferences to config file. */ |
416 | void writeConfig(); | 418 | void writeConfig(); |
417 | 419 | ||
418 | signals: | 420 | signals: |
419 | /** Emitted when the a changed configuration has been stored. */ | 421 | /** Emitted when the a changed configuration has been stored. */ |
420 | void configChanged(); | 422 | void configChanged(); |
421 | 423 | ||
422 | protected slots: | 424 | protected slots: |
423 | /** Apply changes to preferences */ | 425 | /** Apply changes to preferences */ |
424 | void slotApply(); | 426 | void slotApply(); |
425 | 427 | ||
426 | void accept(); | 428 | void accept(); |
427 | /** Accept changes to preferences and close dialog */ | 429 | /** Accept changes to preferences and close dialog */ |
428 | void slotOk(); | 430 | void slotOk(); |
429 | 431 | ||
430 | /** Set preferences to default values */ | 432 | /** Set preferences to default values */ |
431 | void slotDefault(); | 433 | void slotDefault(); |
432 | 434 | ||
433 | protected: | 435 | protected: |
434 | /** Implement this to read custom configuration widgets. */ | 436 | /** Implement this to read custom configuration widgets. */ |
435 | virtual void usrReadConfig() {} | 437 | virtual void usrReadConfig() {} |
436 | /** Implement this to write custom configuration widgets. */ | 438 | /** Implement this to write custom configuration widgets. */ |
437 | virtual void usrWriteConfig() {} | 439 | virtual void usrWriteConfig() {} |
438 | 440 | ||
439 | private: | 441 | private: |
440 | KPrefs *mPrefs; | 442 | KPrefs *mPrefs; |
441 | 443 | ||
442 | QPtrList<KPrefsDialogWid> mPrefsWids; | 444 | Q3PtrList<KPrefsDialogWid> mPrefsWids; |
443 | }; | 445 | }; |
444 | 446 | ||
445 | 447 | ||
446 | #include "kcmconfigs/kdepimconfigwidget.h" | 448 | #include "kcmconfigs/kdepimconfigwidget.h" |
447 | class KPimPrefsGlobalDialog : public KPrefsDialog | 449 | class KPimPrefsGlobalDialog : public KPrefsDialog |
448 | { | 450 | { |
449 | Q_OBJECT | 451 | Q_OBJECT |
450 | public: | 452 | public: |
451 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); | 453 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); |
452 | /** | 454 | /** |
453 | Destructor. | 455 | Destructor. |
454 | */ | 456 | */ |
455 | void showTZconfig(); | 457 | void showTZconfig(); |
456 | 458 | ||
457 | public slots: | 459 | public slots: |
458 | 460 | ||
459 | signals: | 461 | signals: |
460 | protected slots: | 462 | protected slots: |
461 | 463 | ||
462 | protected: | 464 | protected: |
463 | void usrReadConfig(); | 465 | void usrReadConfig(); |
464 | virtual void usrWriteConfig() ; | 466 | virtual void usrWriteConfig() ; |
465 | 467 | ||
466 | private: | 468 | private: |
467 | KDEPIMConfigWidget* kdelibcfg; | 469 | KDEPIMConfigWidget* kdelibcfg; |
468 | 470 | ||
469 | }; | 471 | }; |
470 | 472 | ||
471 | #endif | 473 | #endif |
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp index f6a0b38..51431e2 100644 --- a/libkdepim/kprefswidget.cpp +++ b/libkdepim/kprefswidget.cpp | |||
@@ -1,298 +1,299 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <q3groupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <q3buttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <q3textstream.h> |
35 | #include <qvbox.h> | 35 | #include <q3vbox.h> |
36 | #include <qhbox.h> | 36 | #include <q3hbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <q3frame.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | #include <QDesktopWidget> | ||
45 | 46 | ||
46 | #include <kcolorbutton.h> | 47 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 48 | #include <kdebug.h> |
48 | #include <klocale.h> | 49 | #include <klocale.h> |
49 | #include <kglobal.h> | 50 | #include <kglobal.h> |
50 | #include <kfontdialog.h> | 51 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 52 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 53 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 54 | #include <kiconloader.h> |
54 | 55 | ||
55 | #include "kprefs.h" | 56 | #include "kprefs.h" |
56 | 57 | ||
57 | #include "kprefswidget.h" | 58 | #include "kprefswidget.h" |
58 | //#include "kprefsdialog.moc" | 59 | //#include "kprefsdialog.moc" |
59 | 60 | ||
60 | KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, | 61 | KPrefsWidBool::KPrefsWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 62 | QWidget *parent) |
62 | { | 63 | { |
63 | mReference = reference; | 64 | mReference = reference; |
64 | 65 | ||
65 | mCheck = new QCheckBox(text,parent); | 66 | mCheck = new QCheckBox(text,parent); |
66 | 67 | ||
67 | connect( mCheck, SIGNAL( toggled( bool ) ), SIGNAL( modified() ) ); | 68 | connect( mCheck, SIGNAL( toggled( bool ) ), SIGNAL( modified() ) ); |
68 | 69 | ||
69 | } | 70 | } |
70 | 71 | ||
71 | void KPrefsWidBool::readConfig() | 72 | void KPrefsWidBool::readConfig() |
72 | { | 73 | { |
73 | mCheck->setChecked(*mReference); | 74 | mCheck->setChecked(*mReference); |
74 | } | 75 | } |
75 | 76 | ||
76 | void KPrefsWidBool::writeConfig() | 77 | void KPrefsWidBool::writeConfig() |
77 | { | 78 | { |
78 | *mReference = mCheck->isChecked(); | 79 | *mReference = mCheck->isChecked(); |
79 | } | 80 | } |
80 | 81 | ||
81 | QCheckBox *KPrefsWidBool::checkBox() | 82 | QCheckBox *KPrefsWidBool::checkBox() |
82 | { | 83 | { |
83 | return mCheck; | 84 | return mCheck; |
84 | } | 85 | } |
85 | 86 | ||
86 | 87 | ||
87 | KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, | 88 | KPrefsWidColor::KPrefsWidColor(const QString &text,QColor *reference, |
88 | QWidget *parent) | 89 | QWidget *parent) |
89 | { | 90 | { |
90 | mReference = reference; | 91 | mReference = reference; |
91 | 92 | ||
92 | mButton = new KColorButton(parent); | 93 | mButton = new KColorButton(parent); |
93 | mLabel = new QLabel(mButton, text, parent); | 94 | mLabel = new QLabel(mButton, text, parent); |
94 | mButton->setColor( *mReference ); | 95 | mButton->setColor( *mReference ); |
95 | mButton->setColor( Qt::red ); | 96 | mButton->setColor( Qt::red ); |
96 | 97 | ||
97 | connect( mButton, SIGNAL( changed(const QColor &)), SIGNAL( modified() ) ); | 98 | connect( mButton, SIGNAL( changed(const QColor &)), SIGNAL( modified() ) ); |
98 | 99 | ||
99 | } | 100 | } |
100 | 101 | ||
101 | KPrefsWidColor::~KPrefsWidColor() | 102 | KPrefsWidColor::~KPrefsWidColor() |
102 | { | 103 | { |
103 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; | 104 | // kdDebug(5300) << "KPrefsWidColor::~KPrefsWidColor()" << endl; |
104 | } | 105 | } |
105 | 106 | ||
106 | void KPrefsWidColor::readConfig() | 107 | void KPrefsWidColor::readConfig() |
107 | { | 108 | { |
108 | mButton->setColor(*mReference); | 109 | mButton->setColor(*mReference); |
109 | } | 110 | } |
110 | 111 | ||
111 | void KPrefsWidColor::writeConfig() | 112 | void KPrefsWidColor::writeConfig() |
112 | { | 113 | { |
113 | *mReference = mButton->color(); | 114 | *mReference = mButton->color(); |
114 | } | 115 | } |
115 | 116 | ||
116 | QLabel *KPrefsWidColor::label() | 117 | QLabel *KPrefsWidColor::label() |
117 | { | 118 | { |
118 | return mLabel; | 119 | return mLabel; |
119 | } | 120 | } |
120 | 121 | ||
121 | KColorButton *KPrefsWidColor::button() | 122 | KColorButton *KPrefsWidColor::button() |
122 | { | 123 | { |
123 | return mButton; | 124 | return mButton; |
124 | } | 125 | } |
125 | 126 | ||
126 | KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, | 127 | KPrefsWidFont::KPrefsWidFont(const QString &sampleText,const QString &labelText, |
127 | QFont *reference,QWidget *parent) | 128 | QFont *reference,QWidget *parent) |
128 | { | 129 | { |
129 | mReference = reference; | 130 | mReference = reference; |
130 | 131 | ||
131 | mLabel = new QLabel(labelText, parent); | 132 | mLabel = new QLabel(labelText, parent); |
132 | 133 | ||
133 | mPreview = new QLabel(sampleText,parent); | 134 | mPreview = new QLabel(sampleText,parent); |
134 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 135 | mPreview->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken); |
135 | 136 | ||
136 | mButton = new QPushButton(i18n("Choose..."), parent); | 137 | mButton = new QPushButton(i18n("Choose..."), parent); |
137 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 138 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
138 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 139 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
139 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 140 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
140 | } | 141 | } |
141 | 142 | ||
142 | KPrefsWidFont::~KPrefsWidFont() | 143 | KPrefsWidFont::~KPrefsWidFont() |
143 | { | 144 | { |
144 | } | 145 | } |
145 | 146 | ||
146 | void KPrefsWidFont::readConfig() | 147 | void KPrefsWidFont::readConfig() |
147 | { | 148 | { |
148 | mPreview->setFont(*mReference); | 149 | mPreview->setFont(*mReference); |
149 | } | 150 | } |
150 | 151 | ||
151 | void KPrefsWidFont::writeConfig() | 152 | void KPrefsWidFont::writeConfig() |
152 | { | 153 | { |
153 | *mReference = mPreview->font(); | 154 | *mReference = mPreview->font(); |
154 | } | 155 | } |
155 | 156 | ||
156 | QLabel *KPrefsWidFont::label() | 157 | QLabel *KPrefsWidFont::label() |
157 | { | 158 | { |
158 | return mLabel; | 159 | return mLabel; |
159 | } | 160 | } |
160 | 161 | ||
161 | QLabel *KPrefsWidFont::preview() | 162 | QLabel *KPrefsWidFont::preview() |
162 | { | 163 | { |
163 | return mPreview; | 164 | return mPreview; |
164 | } | 165 | } |
165 | 166 | ||
166 | QPushButton *KPrefsWidFont::button() | 167 | QPushButton *KPrefsWidFont::button() |
167 | { | 168 | { |
168 | return mButton; | 169 | return mButton; |
169 | } | 170 | } |
170 | 171 | ||
171 | void KPrefsWidFont::selectFont() | 172 | void KPrefsWidFont::selectFont() |
172 | { | 173 | { |
173 | QFont myFont(mPreview->font()); | 174 | QFont myFont(mPreview->font()); |
174 | bool ok; | 175 | bool ok; |
175 | myFont = KFontDialog::getFont(myFont, ok); | 176 | myFont = KFontDialog::getFont(myFont, ok); |
176 | if ( ok ) { | 177 | if ( ok ) { |
177 | mPreview->setFont(myFont); | 178 | mPreview->setFont(myFont); |
178 | emit modified(); | 179 | emit modified(); |
179 | } | 180 | } |
180 | } | 181 | } |
181 | 182 | ||
182 | 183 | ||
183 | KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, | 184 | KPrefsWidTime::KPrefsWidTime(const QString &text,int *reference, |
184 | QWidget *parent) | 185 | QWidget *parent) |
185 | { | 186 | { |
186 | mReference = reference; | 187 | mReference = reference; |
187 | 188 | ||
188 | mLabel = new QLabel(text,parent); | 189 | mLabel = new QLabel(text,parent); |
189 | mSpin = new QSpinBox(0,23,1,parent); | 190 | mSpin = new QSpinBox(0,23,1,parent); |
190 | mSpin->setSuffix(":00"); | 191 | mSpin->setSuffix(":00"); |
191 | connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); | 192 | connect( mSpin, SIGNAL( valueChanged(int)), SIGNAL( modified() ) ); |
192 | 193 | ||
193 | } | 194 | } |
194 | 195 | ||
195 | void KPrefsWidTime::readConfig() | 196 | void KPrefsWidTime::readConfig() |
196 | { | 197 | { |
197 | mSpin->setValue(*mReference); | 198 | mSpin->setValue(*mReference); |
198 | } | 199 | } |
199 | 200 | ||
200 | void KPrefsWidTime::writeConfig() | 201 | void KPrefsWidTime::writeConfig() |
201 | { | 202 | { |
202 | *mReference = mSpin->value(); | 203 | *mReference = mSpin->value(); |
203 | } | 204 | } |
204 | 205 | ||
205 | QLabel *KPrefsWidTime::label() | 206 | QLabel *KPrefsWidTime::label() |
206 | { | 207 | { |
207 | return mLabel; | 208 | return mLabel; |
208 | } | 209 | } |
209 | 210 | ||
210 | QSpinBox *KPrefsWidTime::spinBox() | 211 | QSpinBox *KPrefsWidTime::spinBox() |
211 | { | 212 | { |
212 | return mSpin; | 213 | return mSpin; |
213 | } | 214 | } |
214 | 215 | ||
215 | 216 | ||
216 | KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, | 217 | KPrefsWidRadios::KPrefsWidRadios(const QString &text,int *reference, |
217 | QWidget *parent) | 218 | QWidget *parent) |
218 | { | 219 | { |
219 | mReference = reference; | 220 | mReference = reference; |
220 | 221 | ||
221 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 222 | mBox = new Q3ButtonGroup(1,Qt::Horizontal,text,parent); |
222 | connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); | 223 | connect( mBox, SIGNAL( clicked(int)), SIGNAL( modified() ) ); |
223 | } | 224 | } |
224 | 225 | ||
225 | KPrefsWidRadios::~KPrefsWidRadios() | 226 | KPrefsWidRadios::~KPrefsWidRadios() |
226 | { | 227 | { |
227 | } | 228 | } |
228 | 229 | ||
229 | void KPrefsWidRadios::addRadio(const QString &text) | 230 | void KPrefsWidRadios::addRadio(const QString &text) |
230 | { | 231 | { |
231 | new QRadioButton(text,mBox); | 232 | new QRadioButton(text,mBox); |
232 | } | 233 | } |
233 | 234 | ||
234 | QButtonGroup *KPrefsWidRadios::groupBox() | 235 | Q3ButtonGroup *KPrefsWidRadios::groupBox() |
235 | { | 236 | { |
236 | return mBox; | 237 | return mBox; |
237 | } | 238 | } |
238 | 239 | ||
239 | void KPrefsWidRadios::readConfig() | 240 | void KPrefsWidRadios::readConfig() |
240 | { | 241 | { |
241 | mBox->setButton(*mReference); | 242 | mBox->setButton(*mReference); |
242 | } | 243 | } |
243 | 244 | ||
244 | void KPrefsWidRadios::writeConfig() | 245 | void KPrefsWidRadios::writeConfig() |
245 | { | 246 | { |
246 | *mReference = mBox->id(mBox->selected()); | 247 | *mReference = mBox->id(mBox->selected()); |
247 | } | 248 | } |
248 | 249 | ||
249 | 250 | ||
250 | KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, | 251 | KPrefsWidString::KPrefsWidString(const QString &text,QString *reference, |
251 | QWidget *parent, QLineEdit::EchoMode echomode) | 252 | QWidget *parent, QLineEdit::EchoMode echomode) |
252 | { | 253 | { |
253 | mReference = reference; | 254 | mReference = reference; |
254 | 255 | ||
255 | mLabel = new QLabel(text,parent); | 256 | mLabel = new QLabel(text,parent); |
256 | mEdit = new QLineEdit(parent); | 257 | mEdit = new QLineEdit(parent); |
257 | mEdit->setEchoMode( echomode ); | 258 | mEdit->setEchoMode( echomode ); |
258 | connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); | 259 | connect( mEdit, SIGNAL( textChanged(const QString&) ), SIGNAL( modified() ) ); |
259 | 260 | ||
260 | } | 261 | } |
261 | 262 | ||
262 | KPrefsWidString::~KPrefsWidString() | 263 | KPrefsWidString::~KPrefsWidString() |
263 | { | 264 | { |
264 | } | 265 | } |
265 | 266 | ||
266 | void KPrefsWidString::readConfig() | 267 | void KPrefsWidString::readConfig() |
267 | { | 268 | { |
268 | mEdit->setText(*mReference); | 269 | mEdit->setText(*mReference); |
269 | } | 270 | } |
270 | 271 | ||
271 | void KPrefsWidString::writeConfig() | 272 | void KPrefsWidString::writeConfig() |
272 | { | 273 | { |
273 | *mReference = mEdit->text(); | 274 | *mReference = mEdit->text(); |
274 | } | 275 | } |
275 | 276 | ||
276 | QLabel *KPrefsWidString::label() | 277 | QLabel *KPrefsWidString::label() |
277 | { | 278 | { |
278 | return mLabel; | 279 | return mLabel; |
279 | } | 280 | } |
280 | 281 | ||
281 | QLineEdit *KPrefsWidString::lineEdit() | 282 | QLineEdit *KPrefsWidString::lineEdit() |
282 | { | 283 | { |
283 | return mEdit; | 284 | return mEdit; |
284 | } | 285 | } |
285 | 286 | ||
286 | 287 | ||
287 | KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : | 288 | KPrefsWidget::KPrefsWidget(KPrefs *prefs,QWidget *parent,const char *name) : |
288 | QWidget(parent, name ) | 289 | QWidget(parent, name ) |
289 | { | 290 | { |
290 | mPrefs = prefs; | 291 | mPrefs = prefs; |
291 | mPrefsWids.setAutoDelete( true ); | 292 | mPrefsWids.setAutoDelete( true ); |
292 | } | 293 | } |
293 | 294 | ||
294 | KPrefsWidget::~KPrefsWidget() | 295 | KPrefsWidget::~KPrefsWidget() |
295 | { | 296 | { |
296 | } | 297 | } |
297 | 298 | ||
298 | void KPrefsWidget::addWid(KPrefsWid *wid) | 299 | void KPrefsWidget::addWid(KPrefsWid *wid) |
diff --git a/libkdepim/kprefswidget.h b/libkdepim/kprefswidget.h index 8543a39..9de1be5 100644 --- a/libkdepim/kprefswidget.h +++ b/libkdepim/kprefswidget.h | |||
@@ -1,104 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 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 | // $Id$ | 23 | // $Id$ |
24 | 24 | ||
25 | #ifndef _KPREFSWIDGET_H | 25 | #ifndef _KPREFSWIDGET_H |
26 | #define _KPREFSWIDGET_H | 26 | #define _KPREFSWIDGET_H |
27 | 27 | ||
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | 31 | ||
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | //Added by qt3to4: | ||
34 | #include <QLabel> | ||
33 | 35 | ||
34 | class KPrefs; | 36 | class KPrefs; |
35 | 37 | ||
36 | class KColorButton; | 38 | class KColorButton; |
37 | class QCheckBox; | 39 | class QCheckBox; |
38 | class QLabel; | 40 | class QLabel; |
39 | class QSpinBox; | 41 | class QSpinBox; |
40 | class QButtonGroup; | 42 | class Q3ButtonGroup; |
41 | 43 | ||
42 | /** | 44 | /** |
43 | @short Base class for widgets used by @ref KPrefsDialog. | 45 | @short Base class for widgets used by @ref KPrefsDialog. |
44 | @author Cornelius Schumacher | 46 | @author Cornelius Schumacher |
45 | @see KPrefsDialog | 47 | @see KPrefsDialog |
46 | 48 | ||
47 | This class provides the interface for the preferences widgets used by | 49 | This class provides the interface for the preferences widgets used by |
48 | KPrefsDialog. | 50 | KPrefsDialog. |
49 | */ | 51 | */ |
50 | class KPrefsWid : public QObject | 52 | class KPrefsWid : public QObject |
51 | { | 53 | { |
52 | Q_OBJECT | 54 | Q_OBJECT |
53 | public: | 55 | public: |
54 | /** | 56 | /** |
55 | This function is called to read value of the setting from the | 57 | This function is called to read value of the setting from the |
56 | stored configuration and display it in the widget. | 58 | stored configuration and display it in the widget. |
57 | */ | 59 | */ |
58 | virtual void readConfig() = 0; | 60 | virtual void readConfig() = 0; |
59 | /** | 61 | /** |
60 | This function is called to write the current setting of the widget to the | 62 | This function is called to write the current setting of the widget to the |
61 | stored configuration. | 63 | stored configuration. |
62 | */ | 64 | */ |
63 | virtual void writeConfig() = 0; | 65 | virtual void writeConfig() = 0; |
64 | 66 | ||
65 | //connect to this signal if you want to be notified of changes | 67 | //connect to this signal if you want to be notified of changes |
66 | signals: | 68 | signals: |
67 | void modified(); | 69 | void modified(); |
68 | 70 | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | /** | 73 | /** |
72 | @short Widget for bool settings in @ref KPrefsDialog. | 74 | @short Widget for bool settings in @ref KPrefsDialog. |
73 | 75 | ||
74 | This class provides a widget for configuring bool values. It is meant to be | 76 | This class provides a widget for configuring bool values. It is meant to be |
75 | used by KPrefsDialog. The user is responsible for the layout management. | 77 | used by KPrefsDialog. The user is responsible for the layout management. |
76 | */ | 78 | */ |
77 | class KPrefsWidBool : public KPrefsWid | 79 | class KPrefsWidBool : public KPrefsWid |
78 | { | 80 | { |
79 | public: | 81 | public: |
80 | /** | 82 | /** |
81 | Create a bool widget consisting of a QCheckbox. | 83 | Create a bool widget consisting of a QCheckbox. |
82 | 84 | ||
83 | @param text Text of QCheckBox. | 85 | @param text Text of QCheckBox. |
84 | @param reference Pointer to variable read and written by this widget. | 86 | @param reference Pointer to variable read and written by this widget. |
85 | @param parent Parent widget. | 87 | @param parent Parent widget. |
86 | */ | 88 | */ |
87 | KPrefsWidBool(const QString &text,bool *reference,QWidget *parent); | 89 | KPrefsWidBool(const QString &text,bool *reference,QWidget *parent); |
88 | 90 | ||
89 | /** | 91 | /** |
90 | Return the QCheckbox used by this widget. | 92 | Return the QCheckbox used by this widget. |
91 | */ | 93 | */ |
92 | QCheckBox *checkBox(); | 94 | QCheckBox *checkBox(); |
93 | 95 | ||
94 | void readConfig(); | 96 | void readConfig(); |
95 | void writeConfig(); | 97 | void writeConfig(); |
96 | 98 | ||
97 | private: | 99 | private: |
98 | bool *mReference; | 100 | bool *mReference; |
99 | 101 | ||
100 | QCheckBox *mCheck; | 102 | QCheckBox *mCheck; |
101 | }; | 103 | }; |
102 | 104 | ||
103 | /** | 105 | /** |
104 | @short Widget for time settings in @ref KPrefsDialog. | 106 | @short Widget for time settings in @ref KPrefsDialog. |
@@ -204,137 +206,137 @@ class KPrefsWidFont : public KPrefsWid | |||
204 | */ | 206 | */ |
205 | ~KPrefsWidFont(); | 207 | ~KPrefsWidFont(); |
206 | 208 | ||
207 | /** | 209 | /** |
208 | Return label. | 210 | Return label. |
209 | */ | 211 | */ |
210 | QLabel *label(); | 212 | QLabel *label(); |
211 | /** | 213 | /** |
212 | Return QFrame used as preview field. | 214 | Return QFrame used as preview field. |
213 | */ | 215 | */ |
214 | QLabel *preview(); | 216 | QLabel *preview(); |
215 | /** | 217 | /** |
216 | Return button opening the font dialog. | 218 | Return button opening the font dialog. |
217 | */ | 219 | */ |
218 | QPushButton *button(); | 220 | QPushButton *button(); |
219 | 221 | ||
220 | void readConfig(); | 222 | void readConfig(); |
221 | void writeConfig(); | 223 | void writeConfig(); |
222 | 224 | ||
223 | protected slots: | 225 | protected slots: |
224 | void selectFont(); | 226 | void selectFont(); |
225 | 227 | ||
226 | private: | 228 | private: |
227 | QFont *mReference; | 229 | QFont *mReference; |
228 | 230 | ||
229 | QLabel *mLabel; | 231 | QLabel *mLabel; |
230 | QLabel *mPreview; | 232 | QLabel *mPreview; |
231 | QPushButton *mButton; | 233 | QPushButton *mButton; |
232 | }; | 234 | }; |
233 | 235 | ||
234 | /** | 236 | /** |
235 | @short Widget for settings represented by a group of radio buttons in | 237 | @short Widget for settings represented by a group of radio buttons in |
236 | @ref KPrefsDialog. | 238 | @ref KPrefsDialog. |
237 | 239 | ||
238 | This class provides a widget for configuring selections. It is meant to be | 240 | This class provides a widget for configuring selections. It is meant to be |
239 | used by KPrefsDialog. The user is responsible for the layout management. The | 241 | used by KPrefsDialog. The user is responsible for the layout management. The |
240 | setting is interpreted as an int value, corresponding to the position of the | 242 | setting is interpreted as an int value, corresponding to the position of the |
241 | radio button. The position of the button is defined by the sequence of @ref | 243 | radio button. The position of the button is defined by the sequence of @ref |
242 | addRadio() calls, starting with 0. | 244 | addRadio() calls, starting with 0. |
243 | */ | 245 | */ |
244 | class KPrefsWidRadios : public KPrefsWid | 246 | class KPrefsWidRadios : public KPrefsWid |
245 | { | 247 | { |
246 | public: | 248 | public: |
247 | /** | 249 | /** |
248 | Create a widget for selection of an option. It consists of a box with | 250 | Create a widget for selection of an option. It consists of a box with |
249 | several radio buttons. | 251 | several radio buttons. |
250 | 252 | ||
251 | @param text Text of main box. | 253 | @param text Text of main box. |
252 | @param reference Pointer to variable read and written by this widget. | 254 | @param reference Pointer to variable read and written by this widget. |
253 | @param parent Parent widget. | 255 | @param parent Parent widget. |
254 | */ | 256 | */ |
255 | KPrefsWidRadios(const QString &text,int *reference,QWidget *parent); | 257 | KPrefsWidRadios(const QString &text,int *reference,QWidget *parent); |
256 | virtual ~KPrefsWidRadios(); | 258 | virtual ~KPrefsWidRadios(); |
257 | 259 | ||
258 | /** | 260 | /** |
259 | Add a radio button. | 261 | Add a radio button. |
260 | 262 | ||
261 | @param text Text of the button. | 263 | @param text Text of the button. |
262 | */ | 264 | */ |
263 | void addRadio(const QString &text); | 265 | void addRadio(const QString &text); |
264 | 266 | ||
265 | /** | 267 | /** |
266 | Return the box widget used by this widget. | 268 | Return the box widget used by this widget. |
267 | */ | 269 | */ |
268 | QButtonGroup *groupBox(); | 270 | Q3ButtonGroup *groupBox(); |
269 | 271 | ||
270 | void readConfig(); | 272 | void readConfig(); |
271 | void writeConfig(); | 273 | void writeConfig(); |
272 | 274 | ||
273 | private: | 275 | private: |
274 | int *mReference; | 276 | int *mReference; |
275 | 277 | ||
276 | QButtonGroup *mBox; | 278 | Q3ButtonGroup *mBox; |
277 | }; | 279 | }; |
278 | 280 | ||
279 | 281 | ||
280 | /** | 282 | /** |
281 | @short Widget for string settings in @ref KPrefsDialog. | 283 | @short Widget for string settings in @ref KPrefsDialog. |
282 | 284 | ||
283 | This class provides a widget for configuring string values. It is meant to be | 285 | This class provides a widget for configuring string values. It is meant to be |
284 | used by KPrefsDialog. The user is responsible for the layout management. | 286 | used by KPrefsDialog. The user is responsible for the layout management. |
285 | */ | 287 | */ |
286 | class KPrefsWidString : public KPrefsWid | 288 | class KPrefsWidString : public KPrefsWid |
287 | { | 289 | { |
288 | public: | 290 | public: |
289 | /** | 291 | /** |
290 | Create a string widget consisting of a test label and a line edit. | 292 | Create a string widget consisting of a test label and a line edit. |
291 | 293 | ||
292 | @param text Text of label. | 294 | @param text Text of label. |
293 | @param reference Pointer to variable read and written by this widget. | 295 | @param reference Pointer to variable read and written by this widget. |
294 | @param parent Parent widget. | 296 | @param parent Parent widget. |
295 | */ | 297 | */ |
296 | KPrefsWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); | 298 | KPrefsWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); |
297 | /** | 299 | /** |
298 | Destructor. | 300 | Destructor. |
299 | */ | 301 | */ |
300 | virtual ~KPrefsWidString(); | 302 | virtual ~KPrefsWidString(); |
301 | 303 | ||
302 | /** | 304 | /** |
303 | Return label used by this widget. | 305 | Return label used by this widget. |
304 | */ | 306 | */ |
305 | QLabel *label(); | 307 | QLabel *label(); |
306 | /** | 308 | /** |
307 | Return QLineEdit used by this widget. | 309 | Return QLineEdit used by this widget. |
308 | */ | 310 | */ |
309 | QLineEdit *lineEdit(); | 311 | QLineEdit *lineEdit(); |
310 | 312 | ||
311 | void readConfig(); | 313 | void readConfig(); |
312 | void writeConfig(); | 314 | void writeConfig(); |
313 | 315 | ||
314 | private: | 316 | private: |
315 | QString *mReference; | 317 | QString *mReference; |
316 | 318 | ||
317 | QLabel *mLabel; | 319 | QLabel *mLabel; |
318 | QLineEdit *mEdit; | 320 | QLineEdit *mEdit; |
319 | }; | 321 | }; |
320 | 322 | ||
321 | 323 | ||
322 | /** | 324 | /** |
323 | @short Base class for a preferences widget. | 325 | @short Base class for a preferences widget. |
324 | 326 | ||
325 | This class provides the framework for a preferences widget. You have to | 327 | This class provides the framework for a preferences widget. You have to |
326 | subclass it and add the code to create the actual configuration widgets and | 328 | subclass it and add the code to create the actual configuration widgets and |
327 | do the layout management. | 329 | do the layout management. |
328 | 330 | ||
329 | KPrefsWidget provides functions to add subclasses of @ref KPrefsWid. For | 331 | KPrefsWidget provides functions to add subclasses of @ref KPrefsWid. For |
330 | these widgets the reading, writing and setting to default values is handled | 332 | these widgets the reading, writing and setting to default values is handled |
331 | automatically. Custom widgets have to be handled in the functions @ref | 333 | automatically. Custom widgets have to be handled in the functions @ref |
332 | usrReadConfig() and @ref usrWriteConfig(). | 334 | usrReadConfig() and @ref usrWriteConfig(). |
333 | */ | 335 | */ |
334 | class KPrefsWidget : public QWidget | 336 | class KPrefsWidget : public QWidget |
335 | { | 337 | { |
336 | Q_OBJECT | 338 | Q_OBJECT |
337 | public: | 339 | public: |
338 | /** | 340 | /** |
339 | Create a KPrefsDialog for a KPrefs object. | 341 | Create a KPrefsDialog for a KPrefs object. |
340 | 342 | ||
@@ -388,68 +390,68 @@ class KPrefsWidget : public QWidget | |||
388 | Register a @ref KPrefsWidString object. | 390 | Register a @ref KPrefsWidString object. |
389 | 391 | ||
390 | @param text Text of string widget. | 392 | @param text Text of string widget. |
391 | @param reference Reference to variable storing the setting. | 393 | @param reference Reference to variable storing the setting. |
392 | @param parent Parent widget. | 394 | @param parent Parent widget. |
393 | */ | 395 | */ |
394 | KPrefsWidString *addWidString(const QString &text,QString *reference,QWidget *parent); | 396 | KPrefsWidString *addWidString(const QString &text,QString *reference,QWidget *parent); |
395 | /** | 397 | /** |
396 | Register a password @ref KPrefsWidString object, with echomode set to QLineEdit::Password. | 398 | Register a password @ref KPrefsWidString object, with echomode set to QLineEdit::Password. |
397 | 399 | ||
398 | @param text Text of string widget. | 400 | @param text Text of string widget. |
399 | @param reference Reference to variable storing the setting. | 401 | @param reference Reference to variable storing the setting. |
400 | @param parent Parent widget. | 402 | @param parent Parent widget. |
401 | */ | 403 | */ |
402 | KPrefsWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); | 404 | KPrefsWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); |
403 | /** | 405 | /** |
404 | Register a @ref KPrefsWidFont object. | 406 | Register a @ref KPrefsWidFont object. |
405 | 407 | ||
406 | @param sampleText Sample text of font widget. | 408 | @param sampleText Sample text of font widget. |
407 | @param buttonText Button text of font widget. | 409 | @param buttonText Button text of font widget. |
408 | @param reference Reference to variable storing the setting. | 410 | @param reference Reference to variable storing the setting. |
409 | @param parent Parent widget. | 411 | @param parent Parent widget. |
410 | */ | 412 | */ |
411 | KPrefsWidFont *addWidFont(const QString &sampleText,const QString &buttonText, | 413 | KPrefsWidFont *addWidFont(const QString &sampleText,const QString &buttonText, |
412 | QFont *reference,QWidget *parent); | 414 | QFont *reference,QWidget *parent); |
413 | 415 | ||
414 | public slots: | 416 | public slots: |
415 | /** Set all widgets to default values. */ | 417 | /** Set all widgets to default values. */ |
416 | void setDefaults(); | 418 | void setDefaults(); |
417 | 419 | ||
418 | /** Read preferences from config file. */ | 420 | /** Read preferences from config file. */ |
419 | void readConfig(); | 421 | void readConfig(); |
420 | 422 | ||
421 | /** Write preferences to config file. */ | 423 | /** Write preferences to config file. */ |
422 | void writeConfig(); | 424 | void writeConfig(); |
423 | 425 | ||
424 | /** connect this slot to all UI elements */ | 426 | /** connect this slot to all UI elements */ |
425 | void modified(); | 427 | void modified(); |
426 | 428 | ||
427 | signals: | 429 | signals: |
428 | /** Emitted when the a changed configuration has been stored. */ | 430 | /** Emitted when the a changed configuration has been stored. */ |
429 | //US void configChanged(); | 431 | //US void configChanged(); |
430 | void changed( bool ); | 432 | void changed( bool ); |
431 | 433 | ||
432 | protected slots: | 434 | protected slots: |
433 | /** Apply changes to preferences */ | 435 | /** Apply changes to preferences */ |
434 | //US void slotApply(); | 436 | //US void slotApply(); |
435 | 437 | ||
436 | //US void accept(); | 438 | //US void accept(); |
437 | /** Accept changes to preferences and close dialog */ | 439 | /** Accept changes to preferences and close dialog */ |
438 | //US void slotOk(); | 440 | //US void slotOk(); |
439 | 441 | ||
440 | /** Set preferences to default values */ | 442 | /** Set preferences to default values */ |
441 | //US void slotDefault(); | 443 | //US void slotDefault(); |
442 | 444 | ||
443 | protected: | 445 | protected: |
444 | /** Implement this to read custom configuration widgets. */ | 446 | /** Implement this to read custom configuration widgets. */ |
445 | virtual void usrReadConfig() {} | 447 | virtual void usrReadConfig() {} |
446 | /** Implement this to write custom configuration widgets. */ | 448 | /** Implement this to write custom configuration widgets. */ |
447 | virtual void usrWriteConfig() {} | 449 | virtual void usrWriteConfig() {} |
448 | 450 | ||
449 | private: | 451 | private: |
450 | KPrefs *mPrefs; | 452 | KPrefs *mPrefs; |
451 | 453 | ||
452 | QPtrList<KPrefsWid> mPrefsWids; | 454 | Q3PtrList<KPrefsWid> mPrefsWids; |
453 | }; | 455 | }; |
454 | 456 | ||
455 | #endif | 457 | #endif |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 5708dfc..c844627 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1,156 +1,159 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include "ksyncmanager.h" | 23 | #include "ksyncmanager.h" |
24 | 24 | ||
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
32 | #include "ksyncprofile.h" | 32 | #include "ksyncprofile.h" |
33 | #include "ksyncprefsdialog.h" | 33 | #include "ksyncprefsdialog.h" |
34 | #include "kpimprefs.h" | 34 | #include "kpimprefs.h" |
35 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qprogressbar.h> | 38 | #include <q3progressbar.h> |
39 | #include <qpopupmenu.h> | 39 | #include <q3popupmenu.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
42 | #include <qbuttongroup.h> | 42 | #include <q3buttongroup.h> |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qmessagebox.h> | 44 | #include <qmessagebox.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qdialog.h> | 47 | #include <qdialog.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | #include <qtextcodec.h> | 49 | #include <qtextcodec.h> |
50 | #include <qlabel.h> | 50 | #include <qlabel.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qapplication.h> | 52 | #include <qapplication.h> |
53 | #include <QDesktopWidget> | ||
54 | //Added by qt3to4: | ||
55 | #include <Q3VBoxLayout> | ||
53 | 56 | ||
54 | #include <klocale.h> | 57 | #include <klocale.h> |
55 | #include <kglobal.h> | 58 | #include <kglobal.h> |
56 | #include <kconfig.h> | 59 | #include <kconfig.h> |
57 | #include <kfiledialog.h> | 60 | #include <kfiledialog.h> |
58 | 61 | ||
59 | QDateTime KSyncManager::mRequestedSyncEvent; | 62 | QDateTime KSyncManager::mRequestedSyncEvent; |
60 | 63 | ||
61 | 64 | ||
62 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) | 65 | KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu) |
63 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) | 66 | : QObject(), mPrefs(prefs ), mParent(parent),mImplementation(implementation), mTargetApp(ta), mSyncMenu(syncmenu) |
64 | { | 67 | { |
65 | mServerSocket = 0; | 68 | mServerSocket = 0; |
66 | bar = new QProgressBar ( 1, 0 ); | 69 | bar = new Q3ProgressBar ( 1, 0 ); |
67 | bar->setCaption (""); | 70 | bar->setCaption (""); |
68 | mWriteBackInPast = 2; | 71 | mWriteBackInPast = 2; |
69 | 72 | ||
70 | 73 | ||
71 | } | 74 | } |
72 | 75 | ||
73 | KSyncManager::~KSyncManager() | 76 | KSyncManager::~KSyncManager() |
74 | { | 77 | { |
75 | delete bar; | 78 | delete bar; |
76 | } | 79 | } |
77 | 80 | ||
78 | void KSyncManager::setDefaultFileName( QString s) | 81 | void KSyncManager::setDefaultFileName( QString s) |
79 | { | 82 | { |
80 | mDefFileName = s ; | 83 | mDefFileName = s ; |
81 | if ( mPrefs->mPassiveSyncAutoStart ) | 84 | if ( mPrefs->mPassiveSyncAutoStart ) |
82 | enableQuick( false ); | 85 | enableQuick( false ); |
83 | } | 86 | } |
84 | 87 | ||
85 | void KSyncManager::fillSyncMenu() | 88 | void KSyncManager::fillSyncMenu() |
86 | { | 89 | { |
87 | if ( mSyncMenu->count() ) | 90 | if ( mSyncMenu->count() ) |
88 | mSyncMenu->clear(); | 91 | mSyncMenu->clear(); |
89 | 92 | ||
90 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); | 93 | mSyncMenu->insertItem( i18n("Configure..."), 0 ); |
91 | mSyncMenu->insertSeparator(); | 94 | mSyncMenu->insertSeparator(); |
92 | QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); | 95 | Q3PopupMenu *clearMenu = new Q3PopupMenu ( mSyncMenu ); |
93 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); | 96 | mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); |
94 | clearMenu->insertItem( i18n("For all profiles"), 1 ); | 97 | clearMenu->insertItem( i18n("For all profiles"), 1 ); |
95 | clearMenu->insertSeparator(); | 98 | clearMenu->insertSeparator(); |
96 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); | 99 | connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); |
97 | mSyncMenu->insertSeparator(); | 100 | mSyncMenu->insertSeparator(); |
98 | if ( mServerSocket == 0 ) { | 101 | if ( mServerSocket == 0 ) { |
99 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); | 102 | mSyncMenu->insertItem( i18n("Enable Pi-Sync"), 2 ); |
100 | } else { | 103 | } else { |
101 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); | 104 | mSyncMenu->insertItem( i18n("Disable Pi-Sync"), 3 ); |
102 | } | 105 | } |
103 | mSyncMenu->insertSeparator(); | 106 | mSyncMenu->insertSeparator(); |
104 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); | 107 | mSyncMenu->insertItem( i18n("Multiple sync"), 1 ); |
105 | mSyncMenu->insertSeparator(); | 108 | mSyncMenu->insertSeparator(); |
106 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 109 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
107 | config.setGroup("General"); | 110 | config.setGroup("General"); |
108 | QStringList prof = config.readListEntry("SyncProfileNames"); | 111 | QStringList prof = config.readListEntry("SyncProfileNames"); |
109 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 112 | mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
110 | if ( prof.count() < 2 ) { | 113 | if ( prof.count() < 2 ) { |
111 | prof.clear(); | 114 | prof.clear(); |
112 | QString externalName; | 115 | QString externalName; |
113 | #ifdef DESKTOP_VERSION | 116 | #ifdef DESKTOP_VERSION |
114 | #ifdef _WIN32_ | 117 | #ifdef _WIN32_ |
115 | externalName = "OutLook"; | 118 | externalName = "OutLook"; |
116 | #else | 119 | #else |
117 | externalName = "KDE_Desktop"; | 120 | externalName = "KDE_Desktop"; |
118 | #endif | 121 | #endif |
119 | #else | 122 | #else |
120 | externalName = "Sharp_DTM"; | 123 | externalName = "Sharp_DTM"; |
121 | #endif | 124 | #endif |
122 | prof << externalName; | 125 | prof << externalName; |
123 | prof << i18n("Local_file"); | 126 | prof << i18n("Local_file"); |
124 | prof << i18n("Last_file"); | 127 | prof << i18n("Last_file"); |
125 | KSyncProfile* temp = new KSyncProfile (); | 128 | KSyncProfile* temp = new KSyncProfile (); |
126 | temp->setName( prof[0] ); | 129 | temp->setName( prof[0] ); |
127 | temp->writeConfig(&config); | 130 | temp->writeConfig(&config); |
128 | temp->setName( prof[1] ); | 131 | temp->setName( prof[1] ); |
129 | temp->writeConfig(&config); | 132 | temp->writeConfig(&config); |
130 | temp->setName( prof[2] ); | 133 | temp->setName( prof[2] ); |
131 | temp->writeConfig(&config); | 134 | temp->writeConfig(&config); |
132 | config.setGroup("General"); | 135 | config.setGroup("General"); |
133 | config.writeEntry("SyncProfileNames",prof); | 136 | config.writeEntry("SyncProfileNames",prof); |
134 | config.writeEntry("ExternSyncProfiles",externalName); | 137 | config.writeEntry("ExternSyncProfiles",externalName); |
135 | config.sync(); | 138 | config.sync(); |
136 | delete temp; | 139 | delete temp; |
137 | } | 140 | } |
138 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 141 | mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
139 | mSyncProfileNames = prof; | 142 | mSyncProfileNames = prof; |
140 | unsigned int i; | 143 | unsigned int i; |
141 | for ( i = 0; i < prof.count(); ++i ) { | 144 | for ( i = 0; i < prof.count(); ++i ) { |
142 | QString insertText = prof[i]; | 145 | QString insertText = prof[i]; |
143 | if ( i == 0 ) { | 146 | if ( i == 0 ) { |
144 | #ifdef DESKTOP_VERSION | 147 | #ifdef DESKTOP_VERSION |
145 | #ifdef _WIN32_ | 148 | #ifdef _WIN32_ |
146 | insertText = "OutLook"; | 149 | insertText = "OutLook"; |
147 | #else | 150 | #else |
148 | insertText = "KDE_Desktop"; | 151 | insertText = "KDE_Desktop"; |
149 | #endif | 152 | #endif |
150 | #else | 153 | #else |
151 | insertText = "Sharp_DTM"; | 154 | insertText = "Sharp_DTM"; |
152 | #endif | 155 | #endif |
153 | } | 156 | } |
154 | mSyncMenu->insertItem( insertText, 1000+i ); | 157 | mSyncMenu->insertItem( insertText, 1000+i ); |
155 | clearMenu->insertItem( insertText, 1000+i ); | 158 | clearMenu->insertItem( insertText, 1000+i ); |
156 | if ( i == 2 ) | 159 | if ( i == 2 ) |
@@ -294,129 +297,129 @@ void KSyncManager::slotSyncMenu( int action ) | |||
294 | { | 297 | { |
295 | case (KAPI): | 298 | case (KAPI): |
296 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 299 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
297 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 300 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
298 | break; | 301 | break; |
299 | case (KOPI): | 302 | case (KOPI): |
300 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 303 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
301 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 304 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
302 | break; | 305 | break; |
303 | case (PWMPI): | 306 | case (PWMPI): |
304 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 307 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
305 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 308 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
306 | break; | 309 | break; |
307 | default: | 310 | default: |
308 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); | 311 | qDebug("KSM::slotSyncMenu: invalid apptype selected"); |
309 | break; | 312 | break; |
310 | 313 | ||
311 | } | 314 | } |
312 | } else { | 315 | } else { |
313 | if ( temp->getIsPhoneSync() ) { | 316 | if ( temp->getIsPhoneSync() ) { |
314 | mPhoneDevice = temp->getPhoneDevice( ) ; | 317 | mPhoneDevice = temp->getPhoneDevice( ) ; |
315 | mPhoneConnection = temp->getPhoneConnection( ); | 318 | mPhoneConnection = temp->getPhoneConnection( ); |
316 | mPhoneModel = temp->getPhoneModel( ); | 319 | mPhoneModel = temp->getPhoneModel( ); |
317 | syncPhone(); | 320 | syncPhone(); |
318 | } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) { | 321 | } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) { |
319 | mSpecificResources.clear(); | 322 | mSpecificResources.clear(); |
320 | if ( mTargetApp == KAPI ) { | 323 | if ( mTargetApp == KAPI ) { |
321 | if ( temp->getIsPiSyncSpec() ) | 324 | if ( temp->getIsPiSyncSpec() ) |
322 | mSpecificResources = QStringList::split( ":", temp->getResSpecKapi(),true ); | 325 | mSpecificResources = QStringList::split( ":", temp->getResSpecKapi(),true ); |
323 | mPassWordPiSync = temp->getRemotePwAB(); | 326 | mPassWordPiSync = temp->getRemotePwAB(); |
324 | mActiveSyncPort = temp->getRemotePortAB(); | 327 | mActiveSyncPort = temp->getRemotePortAB(); |
325 | mActiveSyncIP = temp->getRemoteIPAB(); | 328 | mActiveSyncIP = temp->getRemoteIPAB(); |
326 | } else if ( mTargetApp == KOPI ) { | 329 | } else if ( mTargetApp == KOPI ) { |
327 | if ( temp->getIsPiSyncSpec() ) | 330 | if ( temp->getIsPiSyncSpec() ) |
328 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); | 331 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); |
329 | mPassWordPiSync = temp->getRemotePw(); | 332 | mPassWordPiSync = temp->getRemotePw(); |
330 | mActiveSyncPort = temp->getRemotePort(); | 333 | mActiveSyncPort = temp->getRemotePort(); |
331 | mActiveSyncIP = temp->getRemoteIP(); | 334 | mActiveSyncIP = temp->getRemoteIP(); |
332 | } else { | 335 | } else { |
333 | mPassWordPiSync = temp->getRemotePwPWM(); | 336 | mPassWordPiSync = temp->getRemotePwPWM(); |
334 | mActiveSyncPort = temp->getRemotePortPWM(); | 337 | mActiveSyncPort = temp->getRemotePortPWM(); |
335 | mActiveSyncIP = temp->getRemoteIPPWM(); | 338 | mActiveSyncIP = temp->getRemoteIPPWM(); |
336 | } | 339 | } |
337 | syncPi(); | 340 | syncPi(); |
338 | while ( !mPisyncFinished ) { | 341 | while ( !mPisyncFinished ) { |
339 | //qDebug("waiting "); | 342 | //qDebug("waiting "); |
340 | qApp->processEvents(); | 343 | qApp->processEvents(); |
341 | } | 344 | } |
342 | } else | 345 | } else |
343 | syncRemote( temp ); | 346 | syncRemote( temp ); |
344 | 347 | ||
345 | } | 348 | } |
346 | } | 349 | } |
347 | delete temp; | 350 | delete temp; |
348 | setBlockSave(false); | 351 | setBlockSave(false); |
349 | } | 352 | } |
350 | 353 | ||
351 | void KSyncManager::enableQuick( bool ask ) | 354 | void KSyncManager::enableQuick( bool ask ) |
352 | { | 355 | { |
353 | bool autoStart; | 356 | bool autoStart; |
354 | bool changed = false; | 357 | bool changed = false; |
355 | if ( ask ) { | 358 | if ( ask ) { |
356 | QDialog dia ( 0, "input-dialog", true ); | 359 | QDialog dia ( 0, "input-dialog", true ); |
357 | QLineEdit lab ( &dia ); | 360 | QLineEdit lab ( &dia ); |
358 | QVBoxLayout lay( &dia ); | 361 | Q3VBoxLayout lay( &dia ); |
359 | lab.setText( mPrefs->mPassiveSyncPort ); | 362 | lab.setText( mPrefs->mPassiveSyncPort ); |
360 | lay.setMargin(7); | 363 | lay.setMargin(7); |
361 | lay.setSpacing(7); | 364 | lay.setSpacing(7); |
362 | int po = 9197+mTargetApp; | 365 | int po = 9197+mTargetApp; |
363 | QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia ); | 366 | QLabel label ( i18n("Port number (Default: %1)\nValid range from 1 to 65535").arg(po), &dia ); |
364 | lay.addWidget( &label); | 367 | lay.addWidget( &label); |
365 | lay.addWidget( &lab); | 368 | lay.addWidget( &lab); |
366 | 369 | ||
367 | QLineEdit lepw ( &dia ); | 370 | QLineEdit lepw ( &dia ); |
368 | lepw.setText( mPrefs->mPassiveSyncPw ); | 371 | lepw.setText( mPrefs->mPassiveSyncPw ); |
369 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 372 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
370 | lay.addWidget( &label2); | 373 | lay.addWidget( &label2); |
371 | lay.addWidget( &lepw); | 374 | lay.addWidget( &lepw); |
372 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); | 375 | QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); |
373 | lay.addWidget( &autostart); | 376 | lay.addWidget( &autostart); |
374 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); | 377 | autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); |
375 | #ifdef DESKTOP_VERSION | 378 | #ifdef DESKTOP_VERSION |
376 | #ifdef _WIN32_ | 379 | #ifdef _WIN32_ |
377 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); | 380 | QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); |
378 | syncdesktop.hide();// not implemented! | 381 | syncdesktop.hide();// not implemented! |
379 | #else | 382 | #else |
380 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); | 383 | QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); |
381 | #endif | 384 | #endif |
382 | lay.addWidget( &syncdesktop); | 385 | lay.addWidget( &syncdesktop); |
383 | #else | 386 | #else |
384 | mPrefs->mPassiveSyncWithDesktop = false; | 387 | mPrefs->mPassiveSyncWithDesktop = false; |
385 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); | 388 | QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); |
386 | syncdesktop.hide(); | 389 | syncdesktop.hide(); |
387 | #endif | 390 | #endif |
388 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); | 391 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); |
389 | 392 | ||
390 | QPushButton pb ( "OK", &dia); | 393 | QPushButton pb ( "OK", &dia); |
391 | lay.addWidget( &pb ); | 394 | lay.addWidget( &pb ); |
392 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 395 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
393 | dia.resize( 230,120 ); | 396 | dia.resize( 230,120 ); |
394 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 397 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
395 | dia.show(); | 398 | dia.show(); |
396 | #ifndef DESKTOP_VERSION | 399 | #ifndef DESKTOP_VERSION |
397 | int dw = QApplication::desktop()->width(); | 400 | int dw = QApplication::desktop()->width(); |
398 | int dh = QApplication::desktop()->height(); | 401 | int dh = QApplication::desktop()->height(); |
399 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); | 402 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); |
400 | #endif | 403 | #endif |
401 | if ( ! dia.exec() ) | 404 | if ( ! dia.exec() ) |
402 | return; | 405 | return; |
403 | dia.hide(); | 406 | dia.hide(); |
404 | qApp->processEvents(); | 407 | qApp->processEvents(); |
405 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { | 408 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { |
406 | changed = true; | 409 | changed = true; |
407 | mPrefs->mPassiveSyncPw = lepw.text(); | 410 | mPrefs->mPassiveSyncPw = lepw.text(); |
408 | } | 411 | } |
409 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { | 412 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { |
410 | mPrefs->mPassiveSyncPort = lab.text(); | 413 | mPrefs->mPassiveSyncPort = lab.text(); |
411 | changed = true; | 414 | changed = true; |
412 | } | 415 | } |
413 | autoStart = autostart.isChecked(); | 416 | autoStart = autostart.isChecked(); |
414 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { | 417 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { |
415 | changed = true; | 418 | changed = true; |
416 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | 419 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); |
417 | } | 420 | } |
418 | } | 421 | } |
419 | else | 422 | else |
420 | autoStart = mPrefs->mPassiveSyncAutoStart; | 423 | autoStart = mPrefs->mPassiveSyncAutoStart; |
421 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | 424 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) |
422 | changed = true; | 425 | changed = true; |
@@ -743,216 +746,216 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
743 | break; | 746 | break; |
744 | default: | 747 | default: |
745 | qDebug("KSM::syncRemote: invalid apptype selected"); | 748 | qDebug("KSM::syncRemote: invalid apptype selected"); |
746 | break; | 749 | break; |
747 | } | 750 | } |
748 | 751 | ||
749 | 752 | ||
750 | int fi; | 753 | int fi; |
751 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { | 754 | if ( (fi = preCommand.find("$PWD$")) > 0 ) { |
752 | QString pwd = getPassword(); | 755 | QString pwd = getPassword(); |
753 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); | 756 | preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); |
754 | 757 | ||
755 | } | 758 | } |
756 | int maxlen = 30; | 759 | int maxlen = 30; |
757 | if ( QApplication::desktop()->width() > 320 ) | 760 | if ( QApplication::desktop()->width() > 320 ) |
758 | maxlen += 25; | 761 | maxlen += 25; |
759 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); | 762 | mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); |
760 | int result = system ( preCommand ); | 763 | int result = system ( preCommand ); |
761 | // 0 : okay | 764 | // 0 : okay |
762 | // 256: no such file or dir | 765 | // 256: no such file or dir |
763 | // | 766 | // |
764 | qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); | 767 | qDebug("KSM::Sync: Remote copy result(0 = okay): %d ",result ); |
765 | if ( result != 0 ) { | 768 | if ( result != 0 ) { |
766 | unsigned int len = maxlen; | 769 | unsigned int len = maxlen; |
767 | while ( len < preCommand.length() ) { | 770 | while ( len < preCommand.length() ) { |
768 | preCommand.insert( len , "\n" ); | 771 | preCommand.insert( len , "\n" ); |
769 | len += maxlen +2; | 772 | len += maxlen +2; |
770 | } | 773 | } |
771 | 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) ; | 774 | 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) ; |
772 | QMessageBox::information( mParent, i18n("Sync - ERROR"), | 775 | QMessageBox::information( mParent, i18n("Sync - ERROR"), |
773 | question, | 776 | question, |
774 | i18n("Okay!")) ; | 777 | i18n("Okay!")) ; |
775 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); | 778 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
776 | return; | 779 | return; |
777 | } | 780 | } |
778 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); | 781 | mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); |
779 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 782 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
780 | 783 | ||
781 | if ( syncWithFile( localTempFile, true ) ) { | 784 | if ( syncWithFile( localTempFile, true ) ) { |
782 | 785 | ||
783 | if ( mWriteBackFile ) { | 786 | if ( mWriteBackFile ) { |
784 | int fi; | 787 | int fi; |
785 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { | 788 | if ( (fi = postCommand.find("$PWD$")) > 0 ) { |
786 | QString pwd = getPassword(); | 789 | QString pwd = getPassword(); |
787 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); | 790 | postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); |
788 | 791 | ||
789 | } | 792 | } |
790 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); | 793 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); |
791 | result = system ( postCommand ); | 794 | result = system ( postCommand ); |
792 | qDebug("KSM::Sync:Writing back file result: %d ", result); | 795 | qDebug("KSM::Sync:Writing back file result: %d ", result); |
793 | if ( result != 0 ) { | 796 | if ( result != 0 ) { |
794 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 797 | mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
795 | return; | 798 | return; |
796 | } else { | 799 | } else { |
797 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 800 | mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
798 | } | 801 | } |
799 | } | 802 | } |
800 | } | 803 | } |
801 | return; | 804 | return; |
802 | } | 805 | } |
803 | bool KSyncManager::edit_pisync_options() | 806 | bool KSyncManager::edit_pisync_options() |
804 | { | 807 | { |
805 | QDialog dia( mParent, "dia", true ); | 808 | QDialog dia( mParent, "dia", true ); |
806 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); | 809 | dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); |
807 | QVBoxLayout lay ( &dia ); | 810 | Q3VBoxLayout lay ( &dia ); |
808 | lay.setSpacing( 5 ); | 811 | lay.setSpacing( 5 ); |
809 | lay.setMargin( 3 ); | 812 | lay.setMargin( 3 ); |
810 | QLabel lab1 ( i18n("Password for remote access:"), &dia); | 813 | QLabel lab1 ( i18n("Password for remote access:"), &dia); |
811 | lay.addWidget( &lab1 ); | 814 | lay.addWidget( &lab1 ); |
812 | QLineEdit le1 (&dia ); | 815 | QLineEdit le1 (&dia ); |
813 | lay.addWidget( &le1 ); | 816 | lay.addWidget( &le1 ); |
814 | QLabel lab2 ( i18n("Remote IP address:"), &dia); | 817 | QLabel lab2 ( i18n("Remote IP address:"), &dia); |
815 | lay.addWidget( &lab2 ); | 818 | lay.addWidget( &lab2 ); |
816 | QLineEdit le2 (&dia ); | 819 | QLineEdit le2 (&dia ); |
817 | lay.addWidget( &le2 ); | 820 | lay.addWidget( &le2 ); |
818 | QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia); | 821 | QLabel lab3 ( i18n("Remote port number:\n(May be: 1 - 65535)"), &dia); |
819 | lay.addWidget( &lab3 ); | 822 | lay.addWidget( &lab3 ); |
820 | QLineEdit le3 (&dia ); | 823 | QLineEdit le3 (&dia ); |
821 | lay.addWidget( &le3 ); | 824 | lay.addWidget( &le3 ); |
822 | QPushButton pb ( "OK", &dia); | 825 | QPushButton pb ( "OK", &dia); |
823 | lay.addWidget( &pb ); | 826 | lay.addWidget( &pb ); |
824 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 827 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
825 | le1.setText( mPassWordPiSync ); | 828 | le1.setText( mPassWordPiSync ); |
826 | le2.setText( mActiveSyncIP ); | 829 | le2.setText( mActiveSyncIP ); |
827 | le3.setText( mActiveSyncPort ); | 830 | le3.setText( mActiveSyncPort ); |
828 | if ( dia.exec() ) { | 831 | if ( dia.exec() ) { |
829 | mPassWordPiSync = le1.text(); | 832 | mPassWordPiSync = le1.text(); |
830 | mActiveSyncPort = le3.text(); | 833 | mActiveSyncPort = le3.text(); |
831 | mActiveSyncIP = le2.text(); | 834 | mActiveSyncIP = le2.text(); |
832 | return true; | 835 | return true; |
833 | } | 836 | } |
834 | return false; | 837 | return false; |
835 | } | 838 | } |
836 | bool KSyncManager::edit_sync_options() | 839 | bool KSyncManager::edit_sync_options() |
837 | { | 840 | { |
838 | 841 | ||
839 | QDialog dia( mParent, "dia", true ); | 842 | QDialog dia( mParent, "dia", true ); |
840 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); | 843 | dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); |
841 | QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); | 844 | Q3ButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); |
842 | QVBoxLayout lay ( &dia ); | 845 | Q3VBoxLayout lay ( &dia ); |
843 | lay.setSpacing( 2 ); | 846 | lay.setSpacing( 2 ); |
844 | lay.setMargin( 3 ); | 847 | lay.setMargin( 3 ); |
845 | lay.addWidget(&gr); | 848 | lay.addWidget(&gr); |
846 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); | 849 | QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); |
847 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); | 850 | QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); |
848 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); | 851 | QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); |
849 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); | 852 | QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); |
850 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); | 853 | QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); |
851 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); | 854 | QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); |
852 | //QRadioButton both( i18n("Take both on conflict"), &gr ); | 855 | //QRadioButton both( i18n("Take both on conflict"), &gr ); |
853 | QPushButton pb ( "OK", &dia); | 856 | QPushButton pb ( "OK", &dia); |
854 | lay.addWidget( &pb ); | 857 | lay.addWidget( &pb ); |
855 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 858 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
856 | switch ( mSyncAlgoPrefs ) { | 859 | switch ( mSyncAlgoPrefs ) { |
857 | case 0: | 860 | case 0: |
858 | loc.setChecked( true); | 861 | loc.setChecked( true); |
859 | break; | 862 | break; |
860 | case 1: | 863 | case 1: |
861 | rem.setChecked( true ); | 864 | rem.setChecked( true ); |
862 | break; | 865 | break; |
863 | case 2: | 866 | case 2: |
864 | newest.setChecked( true); | 867 | newest.setChecked( true); |
865 | break; | 868 | break; |
866 | case 3: | 869 | case 3: |
867 | ask.setChecked( true); | 870 | ask.setChecked( true); |
868 | break; | 871 | break; |
869 | case 4: | 872 | case 4: |
870 | f_loc.setChecked( true); | 873 | f_loc.setChecked( true); |
871 | break; | 874 | break; |
872 | case 5: | 875 | case 5: |
873 | f_rem.setChecked( true); | 876 | f_rem.setChecked( true); |
874 | break; | 877 | break; |
875 | case 6: | 878 | case 6: |
876 | // both.setChecked( true); | 879 | // both.setChecked( true); |
877 | break; | 880 | break; |
878 | default: | 881 | default: |
879 | break; | 882 | break; |
880 | } | 883 | } |
881 | if ( dia.exec() ) { | 884 | if ( dia.exec() ) { |
882 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; | 885 | mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; |
883 | return true; | 886 | return true; |
884 | } | 887 | } |
885 | return false; | 888 | return false; |
886 | } | 889 | } |
887 | 890 | ||
888 | QString KSyncManager::getPassword( ) | 891 | QString KSyncManager::getPassword( ) |
889 | { | 892 | { |
890 | QString retfile = ""; | 893 | QString retfile = ""; |
891 | QDialog dia ( mParent, "input-dialog", true ); | 894 | QDialog dia ( mParent, "input-dialog", true ); |
892 | QLineEdit lab ( &dia ); | 895 | QLineEdit lab ( &dia ); |
893 | lab.setEchoMode( QLineEdit::Password ); | 896 | lab.setEchoMode( QLineEdit::Password ); |
894 | QVBoxLayout lay( &dia ); | 897 | Q3VBoxLayout lay( &dia ); |
895 | lay.setMargin(7); | 898 | lay.setMargin(7); |
896 | lay.setSpacing(7); | 899 | lay.setSpacing(7); |
897 | lay.addWidget( &lab); | 900 | lay.addWidget( &lab); |
898 | dia.setFixedSize( 230,50 ); | 901 | dia.setFixedSize( 230,50 ); |
899 | dia.setCaption( i18n("Enter password") ); | 902 | dia.setCaption( i18n("Enter password") ); |
900 | QPushButton pb ( "OK", &dia); | 903 | QPushButton pb ( "OK", &dia); |
901 | lay.addWidget( &pb ); | 904 | lay.addWidget( &pb ); |
902 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 905 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
903 | dia.show(); | 906 | dia.show(); |
904 | int res = dia.exec(); | 907 | int res = dia.exec(); |
905 | if ( res ) | 908 | if ( res ) |
906 | retfile = lab.text(); | 909 | retfile = lab.text(); |
907 | dia.hide(); | 910 | dia.hide(); |
908 | qApp->processEvents(); | 911 | qApp->processEvents(); |
909 | return retfile; | 912 | return retfile; |
910 | 913 | ||
911 | } | 914 | } |
912 | 915 | ||
913 | 916 | ||
914 | void KSyncManager::confSync() | 917 | void KSyncManager::confSync() |
915 | { | 918 | { |
916 | static KSyncPrefsDialog* sp = 0; | 919 | static KSyncPrefsDialog* sp = 0; |
917 | if ( ! sp ) { | 920 | if ( ! sp ) { |
918 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 921 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
919 | } | 922 | } |
920 | sp->usrReadConfig(); | 923 | sp->usrReadConfig(); |
921 | #ifndef DESKTOP_VERSION | 924 | #ifndef DESKTOP_VERSION |
922 | sp->showMaximized(); | 925 | sp->showMaximized(); |
923 | #else | 926 | #else |
924 | sp->show(); | 927 | sp->show(); |
925 | #endif | 928 | #endif |
926 | sp->exec(); | 929 | sp->exec(); |
927 | QStringList oldSyncProfileNames = mSyncProfileNames; | 930 | QStringList oldSyncProfileNames = mSyncProfileNames; |
928 | mSyncProfileNames = sp->getSyncProfileNames(); | 931 | mSyncProfileNames = sp->getSyncProfileNames(); |
929 | mLocalMachineName = sp->getLocalMachineName (); | 932 | mLocalMachineName = sp->getLocalMachineName (); |
930 | uint ii; | 933 | uint ii; |
931 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { | 934 | for ( ii = 0; ii < oldSyncProfileNames.count(); ++ii ) { |
932 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) | 935 | if ( ! mSyncProfileNames.contains( oldSyncProfileNames[ii] ) ) |
933 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); | 936 | mImplementation->removeSyncInfo( oldSyncProfileNames[ii] ); |
934 | } | 937 | } |
935 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 938 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
936 | } | 939 | } |
937 | void KSyncManager::syncOL() | 940 | void KSyncManager::syncOL() |
938 | { | 941 | { |
939 | mSyncWithDesktop = true; | 942 | mSyncWithDesktop = true; |
940 | emit save(); | 943 | emit save(); |
941 | switch(mTargetApp) | 944 | switch(mTargetApp) |
942 | { | 945 | { |
943 | case (KAPI): | 946 | case (KAPI): |
944 | { | 947 | { |
945 | syncExternalApplication("ol"); | 948 | syncExternalApplication("ol"); |
946 | } | 949 | } |
947 | break; | 950 | break; |
948 | case (KOPI): | 951 | case (KOPI): |
949 | { | 952 | { |
950 | #ifdef DESKTOP_VERSION | 953 | #ifdef DESKTOP_VERSION |
951 | QString command = "kdecaldump33"; | 954 | QString command = "kdecaldump33"; |
952 | QString commandfile = "kdecaldump33"; | 955 | QString commandfile = "kdecaldump33"; |
953 | QString commandpath = qApp->applicationDirPath () + "/"; | 956 | QString commandpath = qApp->applicationDirPath () + "/"; |
954 | #else | 957 | #else |
955 | QString command = "kdecaldump33"; | 958 | QString command = "kdecaldump33"; |
956 | QString commandfile = "kdecaldump33"; | 959 | QString commandfile = "kdecaldump33"; |
957 | QString commandpath = QDir::homeDirPath ()+"/"; | 960 | QString commandpath = QDir::homeDirPath ()+"/"; |
958 | #endif | 961 | #endif |
@@ -1273,611 +1276,611 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | |||
1273 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); | 1276 | mParent->topLevelWidget()->setCaption( i18n("Wrong password: Receiving remote file failed.") ); |
1274 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) | 1277 | else if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) |
1275 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); | 1278 | mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); |
1276 | else if ( state == KCommandSocket::errorCA ) | 1279 | else if ( state == KCommandSocket::errorCA ) |
1277 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); | 1280 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled from remote.") ); |
1278 | else if ( state == KCommandSocket::errorFI ) | 1281 | else if ( state == KCommandSocket::errorFI ) |
1279 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); | 1282 | mParent->topLevelWidget()->setCaption( i18n("File error on remote.") ); |
1280 | else if ( state == KCommandSocket::errorED ) | 1283 | else if ( state == KCommandSocket::errorED ) |
1281 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); | 1284 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); |
1282 | else if ( state == KCommandSocket::errorUN ) | 1285 | else if ( state == KCommandSocket::errorUN ) |
1283 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); | 1286 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); |
1284 | delete s; | 1287 | delete s; |
1285 | if ( state == KCommandSocket::errorR ) { | 1288 | if ( state == KCommandSocket::errorR ) { |
1286 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); | 1289 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1287 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1290 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1288 | commandSocket->sendStop(); | 1291 | commandSocket->sendStop(); |
1289 | } | 1292 | } |
1290 | mPisyncFinished = true; | 1293 | mPisyncFinished = true; |
1291 | return; | 1294 | return; |
1292 | 1295 | ||
1293 | } else if ( state == KCommandSocket::errorW ) { | 1296 | } else if ( state == KCommandSocket::errorW ) { |
1294 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 1297 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
1295 | mPisyncFinished = true; | 1298 | mPisyncFinished = true; |
1296 | 1299 | ||
1297 | } else if ( state == KCommandSocket::successR ) { | 1300 | } else if ( state == KCommandSocket::successR ) { |
1298 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 1301 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
1299 | 1302 | ||
1300 | } else if ( state == KCommandSocket::successW ) { | 1303 | } else if ( state == KCommandSocket::successW ) { |
1301 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); | 1304 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); |
1302 | mPisyncFinished = true; | 1305 | mPisyncFinished = true; |
1303 | } else if ( state == KCommandSocket::quiet ){ | 1306 | } else if ( state == KCommandSocket::quiet ){ |
1304 | qDebug("KSS: quiet "); | 1307 | qDebug("KSS: quiet "); |
1305 | mPisyncFinished = true; | 1308 | mPisyncFinished = true; |
1306 | } else { | 1309 | } else { |
1307 | qDebug("KSS: Error: unknown state: %d ", state); | 1310 | qDebug("KSS: Error: unknown state: %d ", state); |
1308 | mPisyncFinished = true; | 1311 | mPisyncFinished = true; |
1309 | } | 1312 | } |
1310 | 1313 | ||
1311 | delete s; | 1314 | delete s; |
1312 | } | 1315 | } |
1313 | 1316 | ||
1314 | void KSyncManager::readFileFromSocket() | 1317 | void KSyncManager::readFileFromSocket() |
1315 | { | 1318 | { |
1316 | QString fileName = syncFileName(); | 1319 | QString fileName = syncFileName(); |
1317 | bool syncOK = true; | 1320 | bool syncOK = true; |
1318 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1321 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1319 | if ( ! syncWithFile( fileName , true ) ) { | 1322 | if ( ! syncWithFile( fileName , true ) ) { |
1320 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1323 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1321 | syncOK = false; | 1324 | syncOK = false; |
1322 | } | 1325 | } |
1323 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1326 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1324 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1327 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1325 | if ( mWriteBackFile && syncOK ) { | 1328 | if ( mWriteBackFile && syncOK ) { |
1326 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); | 1329 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); |
1327 | commandSocket->writeFile( fileName ); | 1330 | commandSocket->writeFile( fileName ); |
1328 | } | 1331 | } |
1329 | else { | 1332 | else { |
1330 | commandSocket->sendStop(); | 1333 | commandSocket->sendStop(); |
1331 | if ( syncOK ) | 1334 | if ( syncOK ) |
1332 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 1335 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
1333 | mPisyncFinished = true; | 1336 | mPisyncFinished = true; |
1334 | } | 1337 | } |
1335 | } | 1338 | } |
1336 | 1339 | ||
1337 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 1340 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : Q3ServerSocket( port, backlog, parent, name ) |
1338 | { | 1341 | { |
1339 | mPendingConnect = 0; | 1342 | mPendingConnect = 0; |
1340 | mPassWord = pw; | 1343 | mPassWord = pw; |
1341 | mSocket = 0; | 1344 | mSocket = 0; |
1342 | mSyncActionDialog = 0; | 1345 | mSyncActionDialog = 0; |
1343 | blockRC = false; | 1346 | blockRC = false; |
1344 | mErrorMessage = 0; | 1347 | mErrorMessage = 0; |
1345 | } | 1348 | } |
1346 | void KServerSocket::waitForSocketFinish() | 1349 | void KServerSocket::waitForSocketFinish() |
1347 | { | 1350 | { |
1348 | if ( mSocket ) { | 1351 | if ( mSocket ) { |
1349 | //qDebug("KSS:: waiting for finish operation"); | 1352 | //qDebug("KSS:: waiting for finish operation"); |
1350 | QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); | 1353 | QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); |
1351 | return; | 1354 | return; |
1352 | } | 1355 | } |
1353 | mSocket = new QSocket( this ); | 1356 | mSocket = new Q3Socket( this ); |
1354 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1357 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1355 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1358 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1356 | mSocket->setSocket( mPendingConnect ); | 1359 | mSocket->setSocket( mPendingConnect ); |
1357 | mPendingConnect = 0; | 1360 | mPendingConnect = 0; |
1358 | } | 1361 | } |
1359 | void KServerSocket::newConnection ( int socket ) | 1362 | void KServerSocket::newConnection ( int socket ) |
1360 | { | 1363 | { |
1361 | // qDebug("KServerSocket:New connection %d ", socket); | 1364 | // qDebug("KServerSocket:New connection %d ", socket); |
1362 | if ( mPendingConnect ) { | 1365 | if ( mPendingConnect ) { |
1363 | qDebug("KSS::Error : new Connection"); | 1366 | qDebug("KSS::Error : new Connection"); |
1364 | return; | 1367 | return; |
1365 | } | 1368 | } |
1366 | if ( mSocket ) { | 1369 | if ( mSocket ) { |
1367 | mPendingConnect = socket; | 1370 | mPendingConnect = socket; |
1368 | QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); | 1371 | QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); |
1369 | return; | 1372 | return; |
1370 | qDebug("KSS::newConnection Socket deleted! "); | 1373 | qDebug("KSS::newConnection Socket deleted! "); |
1371 | delete mSocket; | 1374 | delete mSocket; |
1372 | mSocket = 0; | 1375 | mSocket = 0; |
1373 | } | 1376 | } |
1374 | mPendingConnect = 0; | 1377 | mPendingConnect = 0; |
1375 | mSocket = new QSocket( this ); | 1378 | mSocket = new Q3Socket( this ); |
1376 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 1379 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
1377 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 1380 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
1378 | mSocket->setSocket( socket ); | 1381 | mSocket->setSocket( socket ); |
1379 | } | 1382 | } |
1380 | 1383 | ||
1381 | void KServerSocket::discardClient() | 1384 | void KServerSocket::discardClient() |
1382 | { | 1385 | { |
1383 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1386 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1384 | } | 1387 | } |
1385 | void KServerSocket::deleteSocket() | 1388 | void KServerSocket::deleteSocket() |
1386 | { | 1389 | { |
1387 | //qDebug("KSS::deleteSocket"); | 1390 | //qDebug("KSS::deleteSocket"); |
1388 | if ( mSocket ) { | 1391 | if ( mSocket ) { |
1389 | delete mSocket; | 1392 | delete mSocket; |
1390 | mSocket = 0; | 1393 | mSocket = 0; |
1391 | } | 1394 | } |
1392 | if ( mErrorMessage ) | 1395 | if ( mErrorMessage ) |
1393 | QTimer::singleShot( 10, this , SLOT ( displayErrorMessage())); | 1396 | QTimer::singleShot( 10, this , SLOT ( displayErrorMessage())); |
1394 | } | 1397 | } |
1395 | void KServerSocket::readClient() | 1398 | void KServerSocket::readClient() |
1396 | { | 1399 | { |
1397 | if ( blockRC ) | 1400 | if ( blockRC ) |
1398 | return; | 1401 | return; |
1399 | if ( mSocket == 0 ) { | 1402 | if ( mSocket == 0 ) { |
1400 | qDebug("ERROR::KSS::readClient(): mSocket == 0 "); | 1403 | qDebug("ERROR::KSS::readClient(): mSocket == 0 "); |
1401 | return; | 1404 | return; |
1402 | } | 1405 | } |
1403 | if ( mErrorMessage ) { | 1406 | if ( mErrorMessage ) { |
1404 | mErrorMessage = 999; | 1407 | mErrorMessage = 999; |
1405 | error_connect("ERROR_ED\r\n\r\n"); | 1408 | error_connect("ERROR_ED\r\n\r\n"); |
1406 | return; | 1409 | return; |
1407 | } | 1410 | } |
1408 | mResource = ""; | 1411 | mResource = ""; |
1409 | mErrorMessage = 0; | 1412 | mErrorMessage = 0; |
1410 | //qDebug("KServerSocket::readClient()"); | 1413 | //qDebug("KServerSocket::readClient()"); |
1411 | if ( mSocket->canReadLine() ) { | 1414 | if ( mSocket->canReadLine() ) { |
1412 | QString line = mSocket->readLine(); | 1415 | QString line = mSocket->readLine(); |
1413 | //qDebug("KServerSocket readline: %s ", line.latin1()); | 1416 | //qDebug("KServerSocket readline: %s ", line.latin1()); |
1414 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | 1417 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); |
1415 | if ( tokens[0] == "GET" ) { | 1418 | if ( tokens[0] == "GET" ) { |
1416 | if ( tokens[1] == mPassWord ) { | 1419 | if ( tokens[1] == mPassWord ) { |
1417 | //emit sendFile( mSocket ); | 1420 | //emit sendFile( mSocket ); |
1418 | bool ok = false; | 1421 | bool ok = false; |
1419 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); | 1422 | QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); |
1420 | if ( ok ) { | 1423 | if ( ok ) { |
1421 | KSyncManager::mRequestedSyncEvent = dt; | 1424 | KSyncManager::mRequestedSyncEvent = dt; |
1422 | } | 1425 | } |
1423 | else | 1426 | else |
1424 | KSyncManager::mRequestedSyncEvent = QDateTime(); | 1427 | KSyncManager::mRequestedSyncEvent = QDateTime(); |
1425 | mResource =tokens[3]; | 1428 | mResource =tokens[3]; |
1426 | send_file(); | 1429 | send_file(); |
1427 | } | 1430 | } |
1428 | else { | 1431 | else { |
1429 | mErrorMessage = 1; | 1432 | mErrorMessage = 1; |
1430 | error_connect("ERROR_PW\r\n\r\n"); | 1433 | error_connect("ERROR_PW\r\n\r\n"); |
1431 | } | 1434 | } |
1432 | } | 1435 | } |
1433 | if ( tokens[0] == "PUT" ) { | 1436 | if ( tokens[0] == "PUT" ) { |
1434 | if ( tokens[1] == mPassWord ) { | 1437 | if ( tokens[1] == mPassWord ) { |
1435 | //emit getFile( mSocket ); | 1438 | //emit getFile( mSocket ); |
1436 | blockRC = true; | 1439 | blockRC = true; |
1437 | mResource =tokens[2]; | 1440 | mResource =tokens[2]; |
1438 | get_file(); | 1441 | get_file(); |
1439 | } | 1442 | } |
1440 | else { | 1443 | else { |
1441 | mErrorMessage = 2; | 1444 | mErrorMessage = 2; |
1442 | error_connect("ERROR_PW\r\n\r\n"); | 1445 | error_connect("ERROR_PW\r\n\r\n"); |
1443 | end_connect(); | 1446 | end_connect(); |
1444 | } | 1447 | } |
1445 | } | 1448 | } |
1446 | if ( tokens[0] == "STOP" ) { | 1449 | if ( tokens[0] == "STOP" ) { |
1447 | //emit endConnect(); | 1450 | //emit endConnect(); |
1448 | end_connect(); | 1451 | end_connect(); |
1449 | } | 1452 | } |
1450 | } | 1453 | } |
1451 | } | 1454 | } |
1452 | void KServerSocket::displayErrorMessage() | 1455 | void KServerSocket::displayErrorMessage() |
1453 | { | 1456 | { |
1454 | if ( mErrorMessage == 1 ) { | 1457 | if ( mErrorMessage == 1 ) { |
1455 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error")); | 1458 | KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"), i18n("Pi-Sync Error")); |
1456 | mErrorMessage = 0; | 1459 | mErrorMessage = 0; |
1457 | } | 1460 | } |
1458 | else if ( mErrorMessage == 2 ) { | 1461 | else if ( mErrorMessage == 2 ) { |
1459 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error")); | 1462 | KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"), i18n("Pi-Sync Error")); |
1460 | mErrorMessage = 0; | 1463 | mErrorMessage = 0; |
1461 | } | 1464 | } |
1462 | } | 1465 | } |
1463 | void KServerSocket::error_connect( QString errmess ) | 1466 | void KServerSocket::error_connect( QString errmess ) |
1464 | { | 1467 | { |
1465 | QTextStream os( mSocket ); | 1468 | Q3TextStream os( mSocket ); |
1466 | os.setEncoding( QTextStream::Latin1 ); | 1469 | os.setEncoding( Q3TextStream::Latin1 ); |
1467 | os << errmess ; | 1470 | os << errmess ; |
1468 | mSocket->close(); | 1471 | mSocket->close(); |
1469 | if ( mSocket->state() == QSocket::Idle ) { | 1472 | if ( mSocket->state() == Q3Socket::Idle ) { |
1470 | QTimer::singleShot( 0, this , SLOT ( discardClient())); | 1473 | QTimer::singleShot( 0, this , SLOT ( discardClient())); |
1471 | } | 1474 | } |
1472 | } | 1475 | } |
1473 | void KServerSocket::end_connect() | 1476 | void KServerSocket::end_connect() |
1474 | { | 1477 | { |
1475 | delete mSyncActionDialog; | 1478 | delete mSyncActionDialog; |
1476 | mSyncActionDialog = 0; | 1479 | mSyncActionDialog = 0; |
1477 | } | 1480 | } |
1478 | void KServerSocket::send_file() | 1481 | void KServerSocket::send_file() |
1479 | { | 1482 | { |
1480 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 1483 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
1481 | if ( mSyncActionDialog ) | 1484 | if ( mSyncActionDialog ) |
1482 | delete mSyncActionDialog; | 1485 | delete mSyncActionDialog; |
1483 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 1486 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
1484 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 1487 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
1485 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); | 1488 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
1486 | label->setAlignment ( Qt::AlignHCenter ); | 1489 | label->setAlignment ( Qt::AlignHCenter ); |
1487 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 1490 | Q3VBoxLayout* lay = new Q3VBoxLayout( mSyncActionDialog ); |
1488 | lay->addWidget( label); | 1491 | lay->addWidget( label); |
1489 | lay->setMargin(7); | 1492 | lay->setMargin(7); |
1490 | lay->setSpacing(7); | 1493 | lay->setSpacing(7); |
1491 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1494 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1492 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); | 1495 | int secs = QDateTime::currentDateTime().secsTo( KSyncManager::mRequestedSyncEvent ); |
1493 | //secs = 333; | 1496 | //secs = 333; |
1494 | if ( secs < 0 ) | 1497 | if ( secs < 0 ) |
1495 | secs = secs * (-1); | 1498 | secs = secs * (-1); |
1496 | if ( secs > 30 ) | 1499 | if ( secs > 30 ) |
1497 | //if ( true ) | 1500 | //if ( true ) |
1498 | { | 1501 | { |
1499 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); | 1502 | QString warning = i18n("Clock skew of\nsyncing devices\nis %1 seconds!").arg( secs ); |
1500 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1503 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1501 | label->setAlignment ( Qt::AlignHCenter ); | 1504 | label->setAlignment ( Qt::AlignHCenter ); |
1502 | lay->addWidget( label); | 1505 | lay->addWidget( label); |
1503 | if ( secs > 180 ) | 1506 | if ( secs > 180 ) |
1504 | { | 1507 | { |
1505 | if ( secs > 300 ) { | 1508 | if ( secs > 300 ) { |
1506 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { | 1509 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(0, i18n("The clocks of the syncing\ndevices have a difference\nof more than 5 minutes.\nPlease adjust your clocks.\nYou may get wrong syncing results!\nPlease confirm synchronization!"), i18n("High clock skew!"),i18n("Synchronize!"))) { |
1507 | qDebug("KSS::Sync cancelled ,cs"); | 1510 | qDebug("KSS::Sync cancelled ,cs"); |
1508 | mErrorMessage = 0; | 1511 | mErrorMessage = 0; |
1509 | end_connect(); | 1512 | end_connect(); |
1510 | error_connect("ERROR_CA\r\n\r\n"); | 1513 | error_connect("ERROR_CA\r\n\r\n"); |
1511 | return ; | 1514 | return ; |
1512 | } | 1515 | } |
1513 | } | 1516 | } |
1514 | QFont f = label->font(); | 1517 | QFont f = label->font(); |
1515 | f.setPointSize ( f.pointSize() *2 ); | 1518 | f.setPointSize ( f.pointSize() *2 ); |
1516 | f. setBold (true ); | 1519 | f. setBold (true ); |
1517 | QLabel* label = new QLabel( warning, mSyncActionDialog ); | 1520 | QLabel* label = new QLabel( warning, mSyncActionDialog ); |
1518 | label->setFont( f ); | 1521 | label->setFont( f ); |
1519 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); | 1522 | warning = i18n("ADJUST\nYOUR\nCLOCKS!"); |
1520 | label->setText( warning ); | 1523 | label->setText( warning ); |
1521 | label->setAlignment ( Qt::AlignHCenter ); | 1524 | label->setAlignment ( Qt::AlignHCenter ); |
1522 | lay->addWidget( label); | 1525 | lay->addWidget( label); |
1523 | mSyncActionDialog->setFixedSize( 230, 300); | 1526 | mSyncActionDialog->setFixedSize( 230, 300); |
1524 | } else { | 1527 | } else { |
1525 | mSyncActionDialog->setFixedSize( 230, 200); | 1528 | mSyncActionDialog->setFixedSize( 230, 200); |
1526 | } | 1529 | } |
1527 | } else { | 1530 | } else { |
1528 | mSyncActionDialog->setFixedSize( 230, 120); | 1531 | mSyncActionDialog->setFixedSize( 230, 120); |
1529 | } | 1532 | } |
1530 | } else | 1533 | } else |
1531 | mSyncActionDialog->setFixedSize( 230, 120); | 1534 | mSyncActionDialog->setFixedSize( 230, 120); |
1532 | mSyncActionDialog->show(); | 1535 | mSyncActionDialog->show(); |
1533 | mSyncActionDialog->raise(); | 1536 | mSyncActionDialog->raise(); |
1534 | emit request_file(mResource); | 1537 | emit request_file(mResource); |
1535 | //emit request_file(); | 1538 | //emit request_file(); |
1536 | qApp->processEvents(); | 1539 | qApp->processEvents(); |
1537 | QString fileName = mFileName; | 1540 | QString fileName = mFileName; |
1538 | QFile file( fileName ); | 1541 | QFile file( fileName ); |
1539 | if (!file.open( IO_ReadOnly ) ) { | 1542 | if (!file.open( QIODevice::ReadOnly ) ) { |
1540 | mErrorMessage = 0; | 1543 | mErrorMessage = 0; |
1541 | end_connect(); | 1544 | end_connect(); |
1542 | error_connect("ERROR_FI\r\n\r\n"); | 1545 | error_connect("ERROR_FI\r\n\r\n"); |
1543 | return ; | 1546 | return ; |
1544 | } | 1547 | } |
1545 | mSyncActionDialog->setCaption( i18n("Sending file...") ); | 1548 | mSyncActionDialog->setCaption( i18n("Sending file...") ); |
1546 | QTextStream ts( &file ); | 1549 | Q3TextStream ts( &file ); |
1547 | ts.setEncoding( QTextStream::Latin1 ); | 1550 | ts.setEncoding( Q3TextStream::Latin1 ); |
1548 | 1551 | ||
1549 | QTextStream os( mSocket ); | 1552 | Q3TextStream os( mSocket ); |
1550 | os.setEncoding( QTextStream::Latin1 ); | 1553 | os.setEncoding( Q3TextStream::Latin1 ); |
1551 | while ( ! ts.atEnd() ) { | 1554 | while ( ! ts.atEnd() ) { |
1552 | os << ts.readLine() << "\r\n"; | 1555 | os << ts.readLine() << "\r\n"; |
1553 | } | 1556 | } |
1554 | os << "\r\n"; | 1557 | os << "\r\n"; |
1555 | //os << ts.read(); | 1558 | //os << ts.read(); |
1556 | file.close(); | 1559 | file.close(); |
1557 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); | 1560 | mSyncActionDialog->setCaption( i18n("Waiting for synced file...") ); |
1558 | mSocket->close(); | 1561 | mSocket->close(); |
1559 | if ( mSocket->state() == QSocket::Idle ) | 1562 | if ( mSocket->state() == Q3Socket::Idle ) |
1560 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1563 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1561 | } | 1564 | } |
1562 | void KServerSocket::get_file() | 1565 | void KServerSocket::get_file() |
1563 | { | 1566 | { |
1564 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); | 1567 | mSyncActionDialog->setCaption( i18n("Receiving synced file...") ); |
1565 | 1568 | ||
1566 | piTime.start(); | 1569 | piTime.start(); |
1567 | piFileString = ""; | 1570 | piFileString = ""; |
1568 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); | 1571 | QTimer::singleShot( 1, this , SLOT (readBackFileFromSocket( ) )); |
1569 | } | 1572 | } |
1570 | 1573 | ||
1571 | 1574 | ||
1572 | void KServerSocket::readBackFileFromSocket() | 1575 | void KServerSocket::readBackFileFromSocket() |
1573 | { | 1576 | { |
1574 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); | 1577 | //qDebug("readBackFileFromSocket() %d ", piTime.elapsed ()); |
1575 | while ( mSocket->canReadLine () ) { | 1578 | while ( mSocket->canReadLine () ) { |
1576 | piTime.restart(); | 1579 | piTime.restart(); |
1577 | QString line = mSocket->readLine (); | 1580 | QString line = mSocket->readLine (); |
1578 | piFileString += line; | 1581 | piFileString += line; |
1579 | //qDebug("readline: %s ", line.latin1()); | 1582 | //qDebug("readline: %s ", line.latin1()); |
1580 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); | 1583 | mSyncActionDialog->setCaption( i18n("Received %1 bytes").arg( piFileString.length() ) ); |
1581 | 1584 | ||
1582 | } | 1585 | } |
1583 | if ( piTime.elapsed () < 3000 ) { | 1586 | if ( piTime.elapsed () < 3000 ) { |
1584 | // wait for more | 1587 | // wait for more |
1585 | //qDebug("waitformore "); | 1588 | //qDebug("waitformore "); |
1586 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 1589 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
1587 | return; | 1590 | return; |
1588 | } | 1591 | } |
1589 | QString fileName = mFileName; | 1592 | QString fileName = mFileName; |
1590 | QFile file ( fileName ); | 1593 | QFile file ( fileName ); |
1591 | if (!file.open( IO_WriteOnly ) ) { | 1594 | if (!file.open( QIODevice::WriteOnly ) ) { |
1592 | delete mSyncActionDialog; | 1595 | delete mSyncActionDialog; |
1593 | mSyncActionDialog = 0; | 1596 | mSyncActionDialog = 0; |
1594 | qDebug("KSS:Error open read back file "); | 1597 | qDebug("KSS:Error open read back file "); |
1595 | piFileString = ""; | 1598 | piFileString = ""; |
1596 | emit file_received( false, mResource); | 1599 | emit file_received( false, mResource); |
1597 | emit file_received( false); | 1600 | emit file_received( false); |
1598 | blockRC = false; | 1601 | blockRC = false; |
1599 | return ; | 1602 | return ; |
1600 | 1603 | ||
1601 | } | 1604 | } |
1602 | 1605 | ||
1603 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1606 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1604 | QTextStream ts ( &file ); | 1607 | Q3TextStream ts ( &file ); |
1605 | ts.setEncoding( QTextStream::Latin1 ); | 1608 | ts.setEncoding( Q3TextStream::Latin1 ); |
1606 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 1609 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
1607 | ts << piFileString; | 1610 | ts << piFileString; |
1608 | mSocket->close(); | 1611 | mSocket->close(); |
1609 | if ( mSocket->state() == QSocket::Idle ) | 1612 | if ( mSocket->state() == Q3Socket::Idle ) |
1610 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1613 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1611 | file.close(); | 1614 | file.close(); |
1612 | piFileString = ""; | 1615 | piFileString = ""; |
1613 | emit file_received( true, mResource ); | 1616 | emit file_received( true, mResource ); |
1614 | emit file_received( true); | 1617 | emit file_received( true); |
1615 | delete mSyncActionDialog; | 1618 | delete mSyncActionDialog; |
1616 | mSyncActionDialog = 0; | 1619 | mSyncActionDialog = 0; |
1617 | blockRC = false; | 1620 | blockRC = false; |
1618 | 1621 | ||
1619 | } | 1622 | } |
1620 | 1623 | ||
1621 | KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) | 1624 | KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) |
1622 | { | 1625 | { |
1623 | mRemoteResource = remres; | 1626 | mRemoteResource = remres; |
1624 | if ( mRemoteResource.isEmpty() ) | 1627 | if ( mRemoteResource.isEmpty() ) |
1625 | mRemoteResource = "ALL"; | 1628 | mRemoteResource = "ALL"; |
1626 | else | 1629 | else |
1627 | mRemoteResource.replace (QRegExp (" "),"_" ); | 1630 | mRemoteResource.replace (QRegExp (" "),"_" ); |
1628 | mPassWord = password; | 1631 | mPassWord = password; |
1629 | mSocket = 0; | 1632 | mSocket = 0; |
1630 | mFirst = false; | 1633 | mFirst = false; |
1631 | mFirstLine = true; | 1634 | mFirstLine = true; |
1632 | mPort = port; | 1635 | mPort = port; |
1633 | mHost = host; | 1636 | mHost = host; |
1634 | tlw = cap; | 1637 | tlw = cap; |
1635 | mRetVal = quiet; | 1638 | mRetVal = quiet; |
1636 | mTimerSocket = new QTimer ( this ); | 1639 | mTimerSocket = new QTimer ( this ); |
1637 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); | 1640 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); |
1638 | mConnectProgress.setCaption( i18n("Pi-Sync") ); | 1641 | mConnectProgress.setCaption( i18n("Pi-Sync") ); |
1639 | connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); | 1642 | connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); |
1640 | mConnectCount = -1; | 1643 | mConnectCount = -1; |
1641 | } | 1644 | } |
1642 | void KCommandSocket::sendFileRequest() | 1645 | void KCommandSocket::sendFileRequest() |
1643 | { | 1646 | { |
1644 | if ( tlw ) | 1647 | if ( tlw ) |
1645 | tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); | 1648 | tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); |
1646 | mConnectProgress.hide(); | 1649 | mConnectProgress.hide(); |
1647 | mConnectCount = 300;mConnectMax = 300; | 1650 | mConnectCount = 300;mConnectMax = 300; |
1648 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); | 1651 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); |
1649 | mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); | 1652 | mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); |
1650 | mTimerSocket->start( 100, true ); | 1653 | mTimerSocket->start( 100, true ); |
1651 | QTextStream os( mSocket ); | 1654 | Q3TextStream os( mSocket ); |
1652 | os.setEncoding( QTextStream::Latin1 ); | 1655 | os.setEncoding( Q3TextStream::Latin1 ); |
1653 | 1656 | ||
1654 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1657 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1655 | os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n"; | 1658 | os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n"; |
1656 | } | 1659 | } |
1657 | 1660 | ||
1658 | void KCommandSocket::readFile( QString fn ) | 1661 | void KCommandSocket::readFile( QString fn ) |
1659 | { | 1662 | { |
1660 | if ( !mSocket ) { | 1663 | if ( !mSocket ) { |
1661 | mSocket = new QSocket( this ); | 1664 | mSocket = new Q3Socket( this ); |
1662 | //qDebug("KCS: read file - new socket"); | 1665 | //qDebug("KCS: read file - new socket"); |
1663 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1666 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1664 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1667 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1665 | connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); | 1668 | connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); |
1666 | } | 1669 | } |
1667 | mFileString = ""; | 1670 | mFileString = ""; |
1668 | mFileName = fn; | 1671 | mFileName = fn; |
1669 | mFirst = true; | 1672 | mFirst = true; |
1670 | if ( tlw ) | 1673 | if ( tlw ) |
1671 | tlw->setCaption( i18n("Trying to connect to remote...") ); | 1674 | tlw->setCaption( i18n("Trying to connect to remote...") ); |
1672 | mConnectCount = 30;mConnectMax = 30; | 1675 | mConnectCount = 30;mConnectMax = 30; |
1673 | mTimerSocket->start( 1000, true ); | 1676 | mTimerSocket->start( 1000, true ); |
1674 | mSocket->connectToHost( mHost, mPort ); | 1677 | mSocket->connectToHost( mHost, mPort ); |
1675 | //qDebug("KCS: Waiting for connection"); | 1678 | //qDebug("KCS: Waiting for connection"); |
1676 | } | 1679 | } |
1677 | void KCommandSocket::updateConnectDialog() | 1680 | void KCommandSocket::updateConnectDialog() |
1678 | { | 1681 | { |
1679 | 1682 | ||
1680 | if ( mConnectCount == mConnectMax ) { | 1683 | if ( mConnectCount == mConnectMax ) { |
1681 | //qDebug("MAXX %d", mConnectMax); | 1684 | //qDebug("MAXX %d", mConnectMax); |
1682 | mConnectProgress.setTotalSteps ( 30 ); | 1685 | mConnectProgress.setTotalSteps ( 30 ); |
1683 | mConnectProgress.show(); | 1686 | mConnectProgress.show(); |
1684 | mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); | 1687 | mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); |
1685 | } | 1688 | } |
1686 | //qDebug("updateConnectDialog() %d", mConnectCount); | 1689 | //qDebug("updateConnectDialog() %d", mConnectCount); |
1687 | mConnectProgress.raise(); | 1690 | mConnectProgress.raise(); |
1688 | mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); | 1691 | mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); |
1689 | --mConnectCount; | 1692 | --mConnectCount; |
1690 | if ( mConnectCount > 0 ) | 1693 | if ( mConnectCount > 0 ) |
1691 | mTimerSocket->start( 1000, true ); | 1694 | mTimerSocket->start( 1000, true ); |
1692 | else | 1695 | else |
1693 | deleteSocket(); | 1696 | deleteSocket(); |
1694 | 1697 | ||
1695 | } | 1698 | } |
1696 | void KCommandSocket::writeFile( QString fileName ) | 1699 | void KCommandSocket::writeFile( QString fileName ) |
1697 | { | 1700 | { |
1698 | if ( !mSocket ) { | 1701 | if ( !mSocket ) { |
1699 | mSocket = new QSocket( this ); | 1702 | mSocket = new Q3Socket( this ); |
1700 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1703 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1701 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 1704 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
1702 | } | 1705 | } |
1703 | mFileName = fileName ; | 1706 | mFileName = fileName ; |
1704 | mConnectCount = 30;mConnectMax = 30; | 1707 | mConnectCount = 30;mConnectMax = 30; |
1705 | mTimerSocket->start( 1000, true ); | 1708 | mTimerSocket->start( 1000, true ); |
1706 | mSocket->connectToHost( mHost, mPort ); | 1709 | mSocket->connectToHost( mHost, mPort ); |
1707 | } | 1710 | } |
1708 | void KCommandSocket::writeFileToSocket() | 1711 | void KCommandSocket::writeFileToSocket() |
1709 | { | 1712 | { |
1710 | mTimerSocket->stop(); | 1713 | mTimerSocket->stop(); |
1711 | QFile file2( mFileName ); | 1714 | QFile file2( mFileName ); |
1712 | if (!file2.open( IO_ReadOnly ) ) { | 1715 | if (!file2.open( QIODevice::ReadOnly ) ) { |
1713 | mConnectProgress.hide(); | 1716 | mConnectProgress.hide(); |
1714 | mConnectCount = -1; | 1717 | mConnectCount = -1; |
1715 | mRetVal= errorW; | 1718 | mRetVal= errorW; |
1716 | mSocket->close(); | 1719 | mSocket->close(); |
1717 | if ( mSocket->state() == QSocket::Idle ) | 1720 | if ( mSocket->state() == Q3Socket::Idle ) |
1718 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1721 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1719 | return ; | 1722 | return ; |
1720 | } | 1723 | } |
1721 | mConnectProgress.setTotalSteps ( file2.size() ); | 1724 | mConnectProgress.setTotalSteps ( file2.size() ); |
1722 | mConnectProgress.show(); | 1725 | mConnectProgress.show(); |
1723 | int count = 0; | 1726 | int count = 0; |
1724 | mConnectProgress.setLabelText( i18n("Sending back synced file...") ); | 1727 | mConnectProgress.setLabelText( i18n("Sending back synced file...") ); |
1725 | mConnectProgress.setProgress( count ); | 1728 | mConnectProgress.setProgress( count ); |
1726 | mConnectProgress.blockSignals( true ); | 1729 | mConnectProgress.blockSignals( true ); |
1727 | QTextStream ts2( &file2 ); | 1730 | Q3TextStream ts2( &file2 ); |
1728 | ts2.setEncoding( QTextStream::Latin1 ); | 1731 | ts2.setEncoding( Q3TextStream::Latin1 ); |
1729 | QTextStream os2( mSocket ); | 1732 | Q3TextStream os2( mSocket ); |
1730 | os2.setEncoding( QTextStream::Latin1 ); | 1733 | os2.setEncoding( Q3TextStream::Latin1 ); |
1731 | os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; | 1734 | os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; |
1732 | int byteCount = 0; | 1735 | int byteCount = 0; |
1733 | int byteMax = file2.size()/53; | 1736 | int byteMax = file2.size()/53; |
1734 | while ( ! ts2.atEnd() ) { | 1737 | while ( ! ts2.atEnd() ) { |
1735 | qApp->processEvents(); | 1738 | qApp->processEvents(); |
1736 | if ( byteCount > byteMax ) { | 1739 | if ( byteCount > byteMax ) { |
1737 | byteCount = 0; | 1740 | byteCount = 0; |
1738 | mConnectProgress.setProgress( count ); | 1741 | mConnectProgress.setProgress( count ); |
1739 | } | 1742 | } |
1740 | QString temp = ts2.readLine(); | 1743 | QString temp = ts2.readLine(); |
1741 | count += temp.length(); | 1744 | count += temp.length(); |
1742 | byteCount += temp.length(); | 1745 | byteCount += temp.length(); |
1743 | os2 << temp << "\r\n"; | 1746 | os2 << temp << "\r\n"; |
1744 | } | 1747 | } |
1745 | file2.close(); | 1748 | file2.close(); |
1746 | mConnectProgress.hide(); | 1749 | mConnectProgress.hide(); |
1747 | mConnectCount = -1; | 1750 | mConnectCount = -1; |
1748 | os2 << "\r\n"; | 1751 | os2 << "\r\n"; |
1749 | mRetVal= successW; | 1752 | mRetVal= successW; |
1750 | mSocket->close(); | 1753 | mSocket->close(); |
1751 | if ( mSocket->state() == QSocket::Idle ) | 1754 | if ( mSocket->state() == Q3Socket::Idle ) |
1752 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1755 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1753 | mConnectProgress.blockSignals( false ); | 1756 | mConnectProgress.blockSignals( false ); |
1754 | } | 1757 | } |
1755 | void KCommandSocket::sendStop() | 1758 | void KCommandSocket::sendStop() |
1756 | { | 1759 | { |
1757 | if ( !mSocket ) { | 1760 | if ( !mSocket ) { |
1758 | mSocket = new QSocket( this ); | 1761 | mSocket = new Q3Socket( this ); |
1759 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1762 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1760 | } | 1763 | } |
1761 | mSocket->connectToHost( mHost, mPort ); | 1764 | mSocket->connectToHost( mHost, mPort ); |
1762 | QTextStream os2( mSocket ); | 1765 | Q3TextStream os2( mSocket ); |
1763 | os2.setEncoding( QTextStream::Latin1 ); | 1766 | os2.setEncoding( Q3TextStream::Latin1 ); |
1764 | os2 << "STOP\r\n\r\n"; | 1767 | os2 << "STOP\r\n\r\n"; |
1765 | mSocket->close(); | 1768 | mSocket->close(); |
1766 | if ( mSocket->state() == QSocket::Idle ) | 1769 | if ( mSocket->state() == Q3Socket::Idle ) |
1767 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1770 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1768 | } | 1771 | } |
1769 | 1772 | ||
1770 | void KCommandSocket::startReadFileFromSocket() | 1773 | void KCommandSocket::startReadFileFromSocket() |
1771 | { | 1774 | { |
1772 | if ( ! mFirst ) | 1775 | if ( ! mFirst ) |
1773 | return; | 1776 | return; |
1774 | mConnectProgress.setLabelText( i18n("Receiving file from remote...") ); | 1777 | mConnectProgress.setLabelText( i18n("Receiving file from remote...") ); |
1775 | mFirst = false; | 1778 | mFirst = false; |
1776 | mFileString = ""; | 1779 | mFileString = ""; |
1777 | mTime.start(); | 1780 | mTime.start(); |
1778 | mFirstLine = true; | 1781 | mFirstLine = true; |
1779 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); | 1782 | QTimer::singleShot( 1, this , SLOT (readFileFromSocket( ) )); |
1780 | 1783 | ||
1781 | } | 1784 | } |
1782 | void KCommandSocket::readFileFromSocket() | 1785 | void KCommandSocket::readFileFromSocket() |
1783 | { | 1786 | { |
1784 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); | 1787 | //qDebug("readBackFileFromSocket() %d ", mTime.elapsed ()); |
1785 | while ( mSocket->canReadLine () ) { | 1788 | while ( mSocket->canReadLine () ) { |
1786 | mTime.restart(); | 1789 | mTime.restart(); |
1787 | QString line = mSocket->readLine (); | 1790 | QString line = mSocket->readLine (); |
1788 | if ( mFirstLine ) { | 1791 | if ( mFirstLine ) { |
1789 | mFirstLine = false; | 1792 | mFirstLine = false; |
1790 | if ( line.left( 6 ) == "ERROR_" ) { | 1793 | if ( line.left( 6 ) == "ERROR_" ) { |
1791 | mTimerSocket->stop(); | 1794 | mTimerSocket->stop(); |
1792 | mConnectCount = -1; | 1795 | mConnectCount = -1; |
1793 | if ( line.left( 8 ) == "ERROR_PW" ) { | 1796 | if ( line.left( 8 ) == "ERROR_PW" ) { |
1794 | mRetVal = errorPW; | 1797 | mRetVal = errorPW; |
1795 | deleteSocket(); | 1798 | deleteSocket(); |
1796 | return ; | 1799 | return ; |
1797 | } | 1800 | } |
1798 | if ( line.left( 8 ) == "ERROR_CA" ) { | 1801 | if ( line.left( 8 ) == "ERROR_CA" ) { |
1799 | mRetVal = errorCA; | 1802 | mRetVal = errorCA; |
1800 | deleteSocket(); | 1803 | deleteSocket(); |
1801 | return ; | 1804 | return ; |
1802 | } | 1805 | } |
1803 | if ( line.left( 8 ) == "ERROR_FI" ) { | 1806 | if ( line.left( 8 ) == "ERROR_FI" ) { |
1804 | mRetVal = errorFI; | 1807 | mRetVal = errorFI; |
1805 | deleteSocket(); | 1808 | deleteSocket(); |
1806 | return ; | 1809 | return ; |
1807 | } | 1810 | } |
1808 | if ( line.left( 8 ) == "ERROR_ED" ) { | 1811 | if ( line.left( 8 ) == "ERROR_ED" ) { |
1809 | mRetVal = errorED; | 1812 | mRetVal = errorED; |
1810 | deleteSocket(); | 1813 | deleteSocket(); |
1811 | return ; | 1814 | return ; |
1812 | } | 1815 | } |
1813 | mRetVal = errorUN; | 1816 | mRetVal = errorUN; |
1814 | deleteSocket(); | 1817 | deleteSocket(); |
1815 | return ; | 1818 | return ; |
1816 | } | 1819 | } |
1817 | } | 1820 | } |
1818 | mFileString += line; | 1821 | mFileString += line; |
1819 | //qDebug("readline: %s ", line.latin1()); | 1822 | //qDebug("readline: %s ", line.latin1()); |
1820 | } | 1823 | } |
1821 | if ( mTime.elapsed () < 3000 ) { | 1824 | if ( mTime.elapsed () < 3000 ) { |
1822 | // wait for more | 1825 | // wait for more |
1823 | //qDebug("waitformore "); | 1826 | //qDebug("waitformore "); |
1824 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); | 1827 | QTimer::singleShot( 100, this , SLOT (readFileFromSocket( ) )); |
1825 | return; | 1828 | return; |
1826 | } | 1829 | } |
1827 | mTimerSocket->stop(); | 1830 | mTimerSocket->stop(); |
1828 | mConnectCount = -1; | 1831 | mConnectCount = -1; |
1829 | mConnectProgress.hide(); | 1832 | mConnectProgress.hide(); |
1830 | QString fileName = mFileName; | 1833 | QString fileName = mFileName; |
1831 | QFile file ( fileName ); | 1834 | QFile file ( fileName ); |
1832 | if (!file.open( IO_WriteOnly ) ) { | 1835 | if (!file.open( QIODevice::WriteOnly ) ) { |
1833 | mFileString = ""; | 1836 | mFileString = ""; |
1834 | mRetVal = errorR; | 1837 | mRetVal = errorR; |
1835 | qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); | 1838 | qDebug("KSS:Error open temp sync file for writing: %s",fileName.latin1() ); |
1836 | deleteSocket(); | 1839 | deleteSocket(); |
1837 | return ; | 1840 | return ; |
1838 | 1841 | ||
1839 | } | 1842 | } |
1840 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1843 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1841 | QTextStream ts ( &file ); | 1844 | Q3TextStream ts ( &file ); |
1842 | ts.setEncoding( QTextStream::Latin1 ); | 1845 | ts.setEncoding( Q3TextStream::Latin1 ); |
1843 | ts << mFileString; | 1846 | ts << mFileString; |
1844 | file.close(); | 1847 | file.close(); |
1845 | mFileString = ""; | 1848 | mFileString = ""; |
1846 | mRetVal = successR; | 1849 | mRetVal = successR; |
1847 | mSocket->close(); | 1850 | mSocket->close(); |
1848 | // if state is not idle, deleteSocket(); is called via | 1851 | // if state is not idle, deleteSocket(); is called via |
1849 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1852 | // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1850 | if ( mSocket->state() == QSocket::Idle ) | 1853 | if ( mSocket->state() == Q3Socket::Idle ) |
1851 | deleteSocket(); | 1854 | deleteSocket(); |
1852 | } | 1855 | } |
1853 | 1856 | ||
1854 | void KCommandSocket::deleteSocket() | 1857 | void KCommandSocket::deleteSocket() |
1855 | { | 1858 | { |
1856 | //qDebug("KCommandSocket::deleteSocket() "); | 1859 | //qDebug("KCommandSocket::deleteSocket() "); |
1857 | mConnectProgress.hide(); | 1860 | mConnectProgress.hide(); |
1858 | 1861 | ||
1859 | if ( mConnectCount >= 0 ) { | 1862 | if ( mConnectCount >= 0 ) { |
1860 | mTimerSocket->stop(); | 1863 | mTimerSocket->stop(); |
1861 | mRetVal = errorTO; | 1864 | mRetVal = errorTO; |
1862 | qDebug("KCS::Connection to remote host timed out"); | 1865 | qDebug("KCS::Connection to remote host timed out"); |
1863 | if ( mSocket ) { | 1866 | if ( mSocket ) { |
1864 | mSocket->close(); | 1867 | mSocket->close(); |
1865 | //if ( mSocket->state() == QSocket::Idle ) | 1868 | //if ( mSocket->state() == QSocket::Idle ) |
1866 | // deleteSocket(); | 1869 | // deleteSocket(); |
1867 | delete mSocket; | 1870 | delete mSocket; |
1868 | mSocket = 0; | 1871 | mSocket = 0; |
1869 | } | 1872 | } |
1870 | if ( mConnectCount == 0 ) | 1873 | if ( mConnectCount == 0 ) |
1871 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); | 1874 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); |
1872 | else if ( tlw ) | 1875 | else if ( tlw ) |
1873 | tlw->setCaption( i18n("Connection to remote host cancelled!") ); | 1876 | tlw->setCaption( i18n("Connection to remote host cancelled!") ); |
1874 | emit commandFinished( this, mRetVal ); | 1877 | emit commandFinished( this, mRetVal ); |
1875 | return; | 1878 | return; |
1876 | } | 1879 | } |
1877 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); | 1880 | //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); |
1878 | if ( mSocket) | 1881 | if ( mSocket) |
1879 | delete mSocket; | 1882 | delete mSocket; |
1880 | mSocket = 0; | 1883 | mSocket = 0; |
1881 | //qDebug("commandFinished "); | 1884 | //qDebug("commandFinished "); |
1882 | emit commandFinished( this, mRetVal ); | 1885 | emit commandFinished( this, mRetVal ); |
1883 | } | 1886 | } |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 71d17e9..32c6557 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,248 +1,250 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | $Id$ | 20 | $Id$ |
21 | */ | 21 | */ |
22 | #ifndef _KSYNCMANAGER_H | 22 | #ifndef _KSYNCMANAGER_H |
23 | #define _KSYNCMANAGER_H | 23 | #define _KSYNCMANAGER_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qsocket.h> | 27 | #include <q3socket.h> |
28 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
29 | #include <qserversocket.h> | 29 | #include <q3serversocket.h> |
30 | #include <qtextstream.h> | 30 | #include <q3textstream.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qprogressdialog.h> | 32 | #include <q3progressdialog.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3PopupMenu> | ||
33 | #include <kdialog.h> | 35 | #include <kdialog.h> |
34 | 36 | ||
35 | class QPopupMenu; | 37 | class Q3PopupMenu; |
36 | class KSyncProfile; | 38 | class KSyncProfile; |
37 | class KPimPrefs; | 39 | class KPimPrefs; |
38 | class QWidget; | 40 | class QWidget; |
39 | class KSyncManager; | 41 | class KSyncManager; |
40 | class KSyncInterface; | 42 | class KSyncInterface; |
41 | class QProgressBar; | 43 | class Q3ProgressBar; |
42 | 44 | ||
43 | 45 | ||
44 | class KServerSocket : public QServerSocket | 46 | class KServerSocket : public Q3ServerSocket |
45 | { | 47 | { |
46 | Q_OBJECT | 48 | Q_OBJECT |
47 | 49 | ||
48 | public: | 50 | public: |
49 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 51 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
50 | 52 | ||
51 | void newConnection ( int socket ) ; | 53 | void newConnection ( int socket ) ; |
52 | void setFileName( QString fn ) {mFileName = fn;}; | 54 | void setFileName( QString fn ) {mFileName = fn;}; |
53 | signals: | 55 | signals: |
54 | void file_received( bool ); | 56 | void file_received( bool ); |
55 | void request_file(); | 57 | void request_file(); |
56 | void file_received( bool, const QString &); | 58 | void file_received( bool, const QString &); |
57 | void request_file(const QString &); | 59 | void request_file(const QString &); |
58 | void saveFile(); | 60 | void saveFile(); |
59 | void endConnect(); | 61 | void endConnect(); |
60 | private slots: | 62 | private slots: |
61 | void waitForSocketFinish(); | 63 | void waitForSocketFinish(); |
62 | void discardClient(); | 64 | void discardClient(); |
63 | void deleteSocket(); | 65 | void deleteSocket(); |
64 | void readClient(); | 66 | void readClient(); |
65 | void displayErrorMessage(); | 67 | void displayErrorMessage(); |
66 | void readBackFileFromSocket(); | 68 | void readBackFileFromSocket(); |
67 | private : | 69 | private : |
68 | int mPendingConnect; | 70 | int mPendingConnect; |
69 | QString mResource; | 71 | QString mResource; |
70 | int mErrorMessage; | 72 | int mErrorMessage; |
71 | bool blockRC; | 73 | bool blockRC; |
72 | void send_file(); | 74 | void send_file(); |
73 | void get_file(); | 75 | void get_file(); |
74 | void end_connect(); | 76 | void end_connect(); |
75 | void error_connect( QString ); | 77 | void error_connect( QString ); |
76 | QDialog* mSyncActionDialog; | 78 | QDialog* mSyncActionDialog; |
77 | QSocket* mSocket; | 79 | Q3Socket* mSocket; |
78 | QString mPassWord; | 80 | QString mPassWord; |
79 | QString mFileName; | 81 | QString mFileName; |
80 | QTime piTime; | 82 | QTime piTime; |
81 | QString piFileString; | 83 | QString piFileString; |
82 | }; | 84 | }; |
83 | 85 | ||
84 | class KCommandSocket : public QObject | 86 | class KCommandSocket : public QObject |
85 | { | 87 | { |
86 | Q_OBJECT | 88 | Q_OBJECT |
87 | public: | 89 | public: |
88 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; | 90 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; |
89 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 91 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
90 | void readFile( QString ); | 92 | void readFile( QString ); |
91 | void writeFile( QString ); | 93 | void writeFile( QString ); |
92 | void sendStop(); | 94 | void sendStop(); |
93 | 95 | ||
94 | private slots : | 96 | private slots : |
95 | void sendFileRequest(); | 97 | void sendFileRequest(); |
96 | void updateConnectDialog(); | 98 | void updateConnectDialog(); |
97 | 99 | ||
98 | signals: | 100 | signals: |
99 | void commandFinished( KCommandSocket*, int ); | 101 | void commandFinished( KCommandSocket*, int ); |
100 | private slots: | 102 | private slots: |
101 | void startReadFileFromSocket(); | 103 | void startReadFileFromSocket(); |
102 | void readFileFromSocket(); | 104 | void readFileFromSocket(); |
103 | void deleteSocket(); | 105 | void deleteSocket(); |
104 | void writeFileToSocket(); | 106 | void writeFileToSocket(); |
105 | private : | 107 | private : |
106 | QString mRemoteResource; | 108 | QString mRemoteResource; |
107 | int mConnectCount; | 109 | int mConnectCount; |
108 | int mConnectMax; | 110 | int mConnectMax; |
109 | KProgressDialog mConnectProgress; | 111 | KProgressDialog mConnectProgress; |
110 | QWidget* tlw; | 112 | QWidget* tlw; |
111 | QSocket* mSocket; | 113 | Q3Socket* mSocket; |
112 | QString mPassWord; | 114 | QString mPassWord; |
113 | Q_UINT16 mPort; | 115 | Q_UINT16 mPort; |
114 | QString mHost; | 116 | QString mHost; |
115 | QString mFileName; | 117 | QString mFileName; |
116 | QTimer* mTimerSocket; | 118 | QTimer* mTimerSocket; |
117 | int mRetVal; | 119 | int mRetVal; |
118 | QTime mTime; | 120 | QTime mTime; |
119 | QString mFileString; | 121 | QString mFileString; |
120 | bool mFirst; | 122 | bool mFirst; |
121 | bool mFirstLine; | 123 | bool mFirstLine; |
122 | }; | 124 | }; |
123 | 125 | ||
124 | 126 | ||
125 | class KSyncManager : public QObject | 127 | class KSyncManager : public QObject |
126 | { | 128 | { |
127 | Q_OBJECT | 129 | Q_OBJECT |
128 | 130 | ||
129 | public: | 131 | public: |
130 | enum TargetApp { | 132 | enum TargetApp { |
131 | KOPI = 0, | 133 | KOPI = 0, |
132 | KAPI = 1, | 134 | KAPI = 1, |
133 | PWMPI = 2 }; | 135 | PWMPI = 2 }; |
134 | 136 | ||
135 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 137 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, Q3PopupMenu* syncmenu); |
136 | ~KSyncManager() ; | 138 | ~KSyncManager() ; |
137 | 139 | ||
138 | void multiSync( bool askforPrefs ); | 140 | void multiSync( bool askforPrefs ); |
139 | bool blockSave() { return mBlockSaveFlag; } | 141 | bool blockSave() { return mBlockSaveFlag; } |
140 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 142 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
141 | void setDefaultFileName( QString s) ; | 143 | void setDefaultFileName( QString s) ; |
142 | QString defaultFileName() { return mDefFileName ;} | 144 | QString defaultFileName() { return mDefFileName ;} |
143 | QString syncFileName(); | 145 | QString syncFileName(); |
144 | void enableQuick( bool ask = true); | 146 | void enableQuick( bool ask = true); |
145 | 147 | ||
146 | bool syncWithDesktop () { return mSyncWithDesktop;} | 148 | bool syncWithDesktop () { return mSyncWithDesktop;} |
147 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 149 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
148 | QString getCurrentSyncName() { return mCurrentSyncName; } | 150 | QString getCurrentSyncName() { return mCurrentSyncName; } |
149 | 151 | ||
150 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 152 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
151 | void hideProgressBar(); | 153 | void hideProgressBar(); |
152 | bool isProgressBarCanceled(); | 154 | bool isProgressBarCanceled(); |
153 | 155 | ||
154 | // sync stuff | 156 | // sync stuff |
155 | QString mLocalMachineName; | 157 | QString mLocalMachineName; |
156 | QStringList mExternSyncProfiles; | 158 | QStringList mExternSyncProfiles; |
157 | QStringList mSyncProfileNames; | 159 | QStringList mSyncProfileNames; |
158 | bool mAskForPreferences; | 160 | bool mAskForPreferences; |
159 | bool mShowSyncSummary; | 161 | bool mShowSyncSummary; |
160 | bool mIsKapiFile; | 162 | bool mIsKapiFile; |
161 | bool mWriteBackExistingOnly; | 163 | bool mWriteBackExistingOnly; |
162 | int mSyncAlgoPrefs; | 164 | int mSyncAlgoPrefs; |
163 | bool mWriteBackFile; | 165 | bool mWriteBackFile; |
164 | int mWriteBackInFuture; | 166 | int mWriteBackInFuture; |
165 | int mWriteBackInPast; | 167 | int mWriteBackInPast; |
166 | QString mPhoneDevice; | 168 | QString mPhoneDevice; |
167 | QString mPhoneConnection; | 169 | QString mPhoneConnection; |
168 | QString mPhoneModel; | 170 | QString mPhoneModel; |
169 | QString mPassWordPiSync; | 171 | QString mPassWordPiSync; |
170 | QString mActiveSyncPort; | 172 | QString mActiveSyncPort; |
171 | QString mActiveSyncIP ; | 173 | QString mActiveSyncIP ; |
172 | QString mFilterInCal; | 174 | QString mFilterInCal; |
173 | QString mFilterOutCal; | 175 | QString mFilterOutCal; |
174 | QString mFilterInAB; | 176 | QString mFilterInAB; |
175 | QString mFilterOutAB; | 177 | QString mFilterOutAB; |
176 | static QDateTime mRequestedSyncEvent; | 178 | static QDateTime mRequestedSyncEvent; |
177 | 179 | ||
178 | signals: | 180 | signals: |
179 | void save(); | 181 | void save(); |
180 | void request_file(); | 182 | void request_file(); |
181 | void getFile( bool ); | 183 | void getFile( bool ); |
182 | void getFile( bool, const QString &); | 184 | void getFile( bool, const QString &); |
183 | void request_file(const QString &); | 185 | void request_file(const QString &); |
184 | void multiResourceSyncStart( bool ); | 186 | void multiResourceSyncStart( bool ); |
185 | 187 | ||
186 | public slots: | 188 | public slots: |
187 | void slotSyncMenu( int ); | 189 | void slotSyncMenu( int ); |
188 | void slotClearMenu( int action ); | 190 | void slotClearMenu( int action ); |
189 | void deleteCommandSocket(KCommandSocket*s, int state); | 191 | void deleteCommandSocket(KCommandSocket*s, int state); |
190 | void readFileFromSocket(); | 192 | void readFileFromSocket(); |
191 | void fillSyncMenu(); | 193 | void fillSyncMenu(); |
192 | 194 | ||
193 | private: | 195 | private: |
194 | void syncPi(); | 196 | void syncPi(); |
195 | KServerSocket * mServerSocket; | 197 | KServerSocket * mServerSocket; |
196 | KPimPrefs* mPrefs; | 198 | KPimPrefs* mPrefs; |
197 | QString mDefFileName; | 199 | QString mDefFileName; |
198 | QString mCurrentSyncDevice; | 200 | QString mCurrentSyncDevice; |
199 | QString mCurrentSyncName; | 201 | QString mCurrentSyncName; |
200 | void quickSyncLocalFile(); | 202 | void quickSyncLocalFile(); |
201 | bool syncWithFile( QString fn , bool quick ); | 203 | bool syncWithFile( QString fn , bool quick ); |
202 | void syncLocalFile(); | 204 | void syncLocalFile(); |
203 | void syncPhone(); | 205 | void syncPhone(); |
204 | void syncSharp(); | 206 | void syncSharp(); |
205 | void syncKDE(); | 207 | void syncKDE(); |
206 | void syncOL(); | 208 | void syncOL(); |
207 | bool syncExternalApplication(QString); | 209 | bool syncExternalApplication(QString); |
208 | int mCurrentSyncProfile ; | 210 | int mCurrentSyncProfile ; |
209 | void syncRemote( KSyncProfile* prof, bool ask = true); | 211 | void syncRemote( KSyncProfile* prof, bool ask = true); |
210 | bool edit_sync_options(); | 212 | bool edit_sync_options(); |
211 | bool edit_pisync_options(); | 213 | bool edit_pisync_options(); |
212 | int ringSync(); | 214 | int ringSync(); |
213 | QString getPassword( ); | 215 | QString getPassword( ); |
214 | bool mPisyncFinished; | 216 | bool mPisyncFinished; |
215 | QStringList mSpecificResources; | 217 | QStringList mSpecificResources; |
216 | QString mCurrentResourceLocal; | 218 | QString mCurrentResourceLocal; |
217 | QString mCurrentResourceRemote; | 219 | QString mCurrentResourceRemote; |
218 | bool mBlockSaveFlag; | 220 | bool mBlockSaveFlag; |
219 | QWidget* mParent; | 221 | QWidget* mParent; |
220 | KSyncInterface* mImplementation; | 222 | KSyncInterface* mImplementation; |
221 | TargetApp mTargetApp; | 223 | TargetApp mTargetApp; |
222 | QPopupMenu* mSyncMenu; | 224 | Q3PopupMenu* mSyncMenu; |
223 | QProgressBar* bar; | 225 | Q3ProgressBar* bar; |
224 | bool mSyncWithDesktop; | 226 | bool mSyncWithDesktop; |
225 | 227 | ||
226 | private slots: | 228 | private slots: |
227 | void displayErrorPort(); | 229 | void displayErrorPort(); |
228 | void confSync(); | 230 | void confSync(); |
229 | 231 | ||
230 | 232 | ||
231 | }; | 233 | }; |
232 | 234 | ||
233 | 235 | ||
234 | class KSyncInterface | 236 | class KSyncInterface |
235 | { | 237 | { |
236 | public : | 238 | public : |
237 | virtual void removeSyncInfo( QString syncProfile) = 0; | 239 | virtual void removeSyncInfo( QString syncProfile) = 0; |
238 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; | 240 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; |
239 | virtual bool syncExternal(KSyncManager* /*manager*/, QString /*resource*/) | 241 | virtual bool syncExternal(KSyncManager* /*manager*/, QString /*resource*/) |
240 | { | 242 | { |
241 | // empty implementation, because some syncable applications do not | 243 | // empty implementation, because some syncable applications do not |
242 | // have an external(sharpdtm) syncmode, like pwmanager. | 244 | // have an external(sharpdtm) syncmode, like pwmanager. |
243 | return false; | 245 | return false; |
244 | } | 246 | } |
245 | }; | 247 | }; |
246 | 248 | ||
247 | 249 | ||
248 | #endif | 250 | #endif |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 2b87298..fd5bbca 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -1,535 +1,539 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <q3groupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <q3buttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qtextstream.h> | 33 | #include <q3textstream.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qvbox.h> | 35 | #include <q3vbox.h> |
36 | #include <qhbox.h> | 36 | #include <q3hbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <q3strlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qscrollview.h> | 45 | #include <q3scrollview.h> |
46 | #include <qvgroupbox.h> | 46 | #include <q3vgroupbox.h> |
47 | #include <qhgroupbox.h> | 47 | #include <q3hgroupbox.h> |
48 | //Added by qt3to4: | ||
49 | #include <Q3HBoxLayout> | ||
50 | #include <Q3GridLayout> | ||
51 | #include <Q3Frame> | ||
48 | 52 | ||
49 | #include <kcolorbutton.h> | 53 | #include <kcolorbutton.h> |
50 | #include <kdebug.h> | 54 | #include <kdebug.h> |
51 | #include <klocale.h> | 55 | #include <klocale.h> |
52 | #include <kglobal.h> | 56 | #include <kglobal.h> |
53 | #include <kfontdialog.h> | 57 | #include <kfontdialog.h> |
54 | #include <kmessagebox.h> | 58 | #include <kmessagebox.h> |
55 | #include <kcolordialog.h> | 59 | #include <kcolordialog.h> |
56 | #include <kiconloader.h> | 60 | #include <kiconloader.h> |
57 | #include <kemailsettings.h> | 61 | #include <kemailsettings.h> |
58 | #include <kstandarddirs.h> | 62 | #include <kstandarddirs.h> |
59 | #include <kfiledialog.h> | 63 | #include <kfiledialog.h> |
60 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
61 | 65 | ||
62 | //#include <kurlrequester.h> | 66 | //#include <kurlrequester.h> |
63 | #include <klineedit.h> | 67 | #include <klineedit.h> |
64 | #include "ksyncprofile.h" | 68 | #include "ksyncprofile.h" |
65 | 69 | ||
66 | 70 | ||
67 | //#include "koprefs.h" | 71 | //#include "koprefs.h" |
68 | 72 | ||
69 | #include "ksyncprefsdialog.h" | 73 | #include "ksyncprefsdialog.h" |
70 | //#include "koglobals.h" | 74 | //#include "koglobals.h" |
71 | 75 | ||
72 | 76 | ||
73 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | 77 | KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : |
74 | KDialog(parent,name,true) | 78 | KDialog(parent,name,true) |
75 | { | 79 | { |
76 | 80 | ||
77 | setCaption( i18n("Synchronization Preferences")); | 81 | setCaption( i18n("Synchronization Preferences")); |
78 | 82 | ||
79 | mSyncProfiles.setAutoDelete( true ); | 83 | mSyncProfiles.setAutoDelete( true ); |
80 | setupSyncAlgTab(); | 84 | setupSyncAlgTab(); |
81 | } | 85 | } |
82 | 86 | ||
83 | 87 | ||
84 | KSyncPrefsDialog::~KSyncPrefsDialog() | 88 | KSyncPrefsDialog::~KSyncPrefsDialog() |
85 | { | 89 | { |
86 | } | 90 | } |
87 | 91 | ||
88 | void KSyncPrefsDialog::setupSyncAlgTab() | 92 | void KSyncPrefsDialog::setupSyncAlgTab() |
89 | { | 93 | { |
90 | QLabel * lab; | 94 | QLabel * lab; |
91 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); | 95 | //QFrame *page = addPage(i18n("Sync Prefs"),0,0); |
92 | QVBox * mainbox = new QVBox( this ); | 96 | Q3VBox * mainbox = new Q3VBox( this ); |
93 | QScrollView* sv = new QScrollView( mainbox ); | 97 | Q3ScrollView* sv = new Q3ScrollView( mainbox ); |
94 | QHBoxLayout * lay = new QHBoxLayout( this ); | 98 | Q3HBoxLayout * lay = new Q3HBoxLayout( this ); |
95 | lay->addWidget( mainbox ); | 99 | lay->addWidget( mainbox ); |
96 | QHBox * b_box = new QHBox( mainbox ); | 100 | Q3HBox * b_box = new Q3HBox( mainbox ); |
97 | 101 | ||
98 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); | 102 | QPushButton* button = new QPushButton( i18n("Ok"), b_box ); |
99 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); | 103 | connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); |
100 | button = new QPushButton( i18n("Cancel"), b_box ); | 104 | button = new QPushButton( i18n("Cancel"), b_box ); |
101 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); | 105 | connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); |
102 | //QBoxLayout * sl = new QVBoxLayout(this ); | 106 | //QBoxLayout * sl = new QVBoxLayout(this ); |
103 | //sl->addWidget ( sv ); | 107 | //sl->addWidget ( sv ); |
104 | sv->setResizePolicy ( QScrollView::AutoOneFit ); | 108 | sv->setResizePolicy ( Q3ScrollView::AutoOneFit ); |
105 | QFrame *topFrame = new QFrame ( sv ); | 109 | Q3Frame *topFrame = new Q3Frame ( sv ); |
106 | sv->addChild( topFrame ); | 110 | sv->addChild( topFrame ); |
107 | mSetupSyncAlgTab = topFrame; | 111 | mSetupSyncAlgTab = topFrame; |
108 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 112 | Q3GridLayout *topLayout = new Q3GridLayout(topFrame,6,2); |
109 | topLayout->setSpacing(spacingHint()); | 113 | topLayout->setSpacing(spacingHint()); |
110 | topLayout->setMargin(marginHint()); | 114 | topLayout->setMargin(marginHint()); |
111 | 115 | ||
112 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); | 116 | //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); |
113 | int iii = 0; | 117 | int iii = 0; |
114 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); | 118 | //topLayout->addMultiCellWidget(lab , iii,iii,0,1); |
115 | //++iii; | 119 | //++iii; |
116 | 120 | ||
117 | mMyMachineName = new QLineEdit(topFrame); | 121 | mMyMachineName = new QLineEdit(topFrame); |
118 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); | 122 | lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); |
119 | topLayout->addWidget(lab ,iii,0); | 123 | topLayout->addWidget(lab ,iii,0); |
120 | topLayout->addWidget(mMyMachineName,iii,1); | 124 | topLayout->addWidget(mMyMachineName,iii,1); |
121 | ++iii; | 125 | ++iii; |
122 | 126 | ||
123 | QHBox* buttonbox = new QHBox( topFrame); | 127 | Q3HBox* buttonbox = new Q3HBox( topFrame); |
124 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); | 128 | topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); |
125 | ++iii; | 129 | ++iii; |
126 | button = new QPushButton( i18n("New profile"), buttonbox ); | 130 | button = new QPushButton( i18n("New profile"), buttonbox ); |
127 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); | 131 | connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); |
128 | 132 | ||
129 | button = new QPushButton( i18n("Clone profile"), buttonbox ); | 133 | button = new QPushButton( i18n("Clone profile"), buttonbox ); |
130 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); | 134 | connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); |
131 | 135 | ||
132 | button = new QPushButton( i18n("Delete profile"), buttonbox ); | 136 | button = new QPushButton( i18n("Delete profile"), buttonbox ); |
133 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); | 137 | connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); |
134 | 138 | ||
135 | mProfileBox = new QComboBox(topFrame); | 139 | mProfileBox = new QComboBox(topFrame); |
136 | mProfileBox->setEditable ( true ); | 140 | mProfileBox->setEditable ( true ); |
137 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); | 141 | mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); |
138 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); | 142 | connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); |
139 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); | 143 | connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); |
140 | 144 | ||
141 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); | 145 | lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); |
142 | topLayout->addWidget(lab ,iii,0); | 146 | topLayout->addWidget(lab ,iii,0); |
143 | topLayout->addWidget(mProfileBox, iii,1); | 147 | topLayout->addWidget(mProfileBox, iii,1); |
144 | ++iii; | 148 | ++iii; |
145 | 149 | ||
146 | 150 | ||
147 | 151 | ||
148 | QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame); | 152 | Q3HGroupBox *iims = new Q3HGroupBox( i18n("Multiple Sync options"), topFrame); |
149 | new QLabel( i18n("Include in multiple "), iims ); | 153 | new QLabel( i18n("Include in multiple "), iims ); |
150 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); | 154 | mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); |
151 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); | 155 | mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); |
152 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); | 156 | mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); |
153 | new QLabel( i18n(" sync"), iims ); | 157 | new QLabel( i18n(" sync"), iims ); |
154 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); | 158 | topLayout->addMultiCellWidget(iims, iii,iii,0,1); |
155 | ++iii; | 159 | ++iii; |
156 | QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); | 160 | Q3VGroupBox* gb0 = new Q3VGroupBox( i18n("Sync algo options"), topFrame); |
157 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); | 161 | topLayout->addMultiCellWidget(gb0, iii,iii,0,1); |
158 | ++iii; | 162 | ++iii; |
159 | QButtonGroup* gr; | 163 | Q3ButtonGroup* gr; |
160 | { | 164 | { |
161 | QVGroupBox* topFrame = gb0; | 165 | Q3VGroupBox* topFrame = gb0; |
162 | 166 | ||
163 | 167 | ||
164 | 168 | ||
165 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); | 169 | mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); |
166 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); | 170 | //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); |
167 | //++iii; | 171 | //++iii; |
168 | gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); | 172 | gr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); |
169 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 173 | //topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
170 | //++iii; | 174 | //++iii; |
171 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); | 175 | loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); |
172 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); | 176 | rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); |
173 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); | 177 | newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); |
174 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); | 178 | ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); |
175 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); | 179 | f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); |
176 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); | 180 | f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); |
177 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); | 181 | // both = new QRadioButton ( i18n("Take both on conflict"), gr ); |
178 | 182 | ||
179 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); | 183 | mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); |
180 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); | 184 | //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); |
181 | //++iii; | 185 | //++iii; |
182 | 186 | ||
183 | #if 0 | 187 | #if 0 |
184 | QHGroupBox* gb51 = new QHGroupBox( i18n("Local resources to sync with:"), topFrame); | 188 | Q3HGroupBox* gb51 = new Q3HGroupBox( i18n("Local resources to sync with:"), topFrame); |
185 | { | 189 | { |
186 | QVBox * fibo2 = new QVBox ( gb51 ); | 190 | Q3VBox * fibo2 = new Q3VBox ( gb51 ); |
187 | new QLabel ( i18n("Calendar resources:"), fibo2 ); | 191 | new QLabel ( i18n("Calendar resources:"), fibo2 ); |
188 | //mFilterInCal = new QComboBox( fibo2 ); | 192 | //mFilterInCal = new QComboBox( fibo2 ); |
189 | fibo2 = new QVBox ( gb51 ); | 193 | fibo2 = new Q3VBox ( gb51 ); |
190 | new QLabel ( i18n("Addressbook resources:"), fibo2 ); | 194 | new QLabel ( i18n("Addressbook resources:"), fibo2 ); |
191 | //mFilterInAB = new QComboBox( fibo2 ); | 195 | //mFilterInAB = new QComboBox( fibo2 ); |
192 | } | 196 | } |
193 | #endif | 197 | #endif |
194 | QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame); | 198 | Q3HGroupBox* gb5 = new Q3HGroupBox( i18n("Apply filter when adding data to local:"), topFrame); |
195 | QVBox * fibo2 = new QVBox ( gb5 ); | 199 | Q3VBox * fibo2 = new Q3VBox ( gb5 ); |
196 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); | 200 | new QLabel ( i18n("Incoming calendar filter:"), fibo2 ); |
197 | mFilterInCal = new QComboBox( fibo2 ); | 201 | mFilterInCal = new QComboBox( fibo2 ); |
198 | fibo2 = new QVBox ( gb5 ); | 202 | fibo2 = new Q3VBox ( gb5 ); |
199 | new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); | 203 | new QLabel ( i18n("Incoming addressbook filter:"), fibo2 ); |
200 | mFilterInAB = new QComboBox( fibo2 ); | 204 | mFilterInAB = new QComboBox( fibo2 ); |
201 | 205 | ||
202 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); | 206 | mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); |
203 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); | 207 | // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); |
204 | // ++iii; | 208 | // ++iii; |
205 | 209 | ||
206 | QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); | 210 | Q3VGroupBox* gb2 = new Q3VGroupBox( i18n("Write back options"), topFrame); |
207 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); | 211 | //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); |
208 | //++iii; | 212 | //++iii; |
209 | { | 213 | { |
210 | QVGroupBox*topFrame = gb2; | 214 | Q3VGroupBox*topFrame = gb2; |
211 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); | 215 | mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); |
212 | QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); | 216 | Q3HGroupBox* gb4 = new Q3HGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); |
213 | QVBox * fibo = new QVBox ( gb4 ); | 217 | Q3VBox * fibo = new Q3VBox ( gb4 ); |
214 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); | 218 | new QLabel ( i18n("Outgoing calendar filter:"), fibo ); |
215 | mFilterOutCal = new QComboBox( fibo ); | 219 | mFilterOutCal = new QComboBox( fibo ); |
216 | fibo = new QVBox ( gb4 ); | 220 | fibo = new Q3VBox ( gb4 ); |
217 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); | 221 | new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); |
218 | mFilterOutAB = new QComboBox( fibo ); | 222 | mFilterOutAB = new QComboBox( fibo ); |
219 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); | 223 | //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); |
220 | //++iii; | 224 | //++iii; |
221 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); | 225 | mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); |
222 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); | 226 | //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); |
223 | //++iii; | 227 | //++iii; |
224 | QVGroupBox* gb3 = new QVGroupBox( i18n("Time period"), topFrame); | 228 | Q3VGroupBox* gb3 = new Q3VGroupBox( i18n("Time period"), topFrame); |
225 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); | 229 | connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); |
226 | 230 | ||
227 | new QLabel( i18n("From ") , gb3 ); | 231 | new QLabel( i18n("From ") , gb3 ); |
228 | QHBox * tf1 = new QHBox ( gb3 ); | 232 | Q3HBox * tf1 = new Q3HBox ( gb3 ); |
229 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 ); | 233 | mWriteBackPastWeeks= new QSpinBox(1,104, 1, tf1 ); |
230 | mWriteBackPastWeeks->setMaximumWidth( 100 ); | 234 | mWriteBackPastWeeks->setMaximumWidth( 100 ); |
231 | new QLabel( i18n(" weeks in the past to ") ,tf1 ); | 235 | new QLabel( i18n(" weeks in the past to ") ,tf1 ); |
232 | QHBox * tf2 = new QHBox ( gb3 ); | 236 | Q3HBox * tf2 = new Q3HBox ( gb3 ); |
233 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2); | 237 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, tf2); |
234 | mWriteBackFutureWeeks->setMaximumWidth( 100 ); | 238 | mWriteBackFutureWeeks->setMaximumWidth( 100 ); |
235 | new QLabel( i18n(" weeks in the future ") , tf2 ); | 239 | new QLabel( i18n(" weeks in the future ") , tf2 ); |
236 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); | 240 | //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); |
237 | //++iii; | 241 | //++iii; |
238 | gb3->setEnabled( false ); | 242 | gb3->setEnabled( false ); |
239 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); | 243 | connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); |
240 | } | 244 | } |
241 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); | 245 | connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); |
242 | 246 | ||
243 | } | 247 | } |
244 | proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); | 248 | proGr = new Q3ButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); |
245 | gr = proGr; | 249 | gr = proGr; |
246 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); | 250 | topLayout->addMultiCellWidget(gr, iii,iii,0,1); |
247 | ++iii; | 251 | ++iii; |
248 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); | 252 | mIsLocal = new QRadioButton ( i18n("Local file"), gr ); |
249 | mIsPi = new QRadioButton ( i18n("Pi-Sync - all calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); | 253 | mIsPi = new QRadioButton ( i18n("Pi-Sync - all calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
250 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 254 | connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
251 | mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); | 255 | mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected calendars ( direct Kx/Pi to Kx/Pi sync )"), gr ); |
252 | connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 256 | connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
253 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); | 257 | mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); |
254 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 258 | connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
255 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); | 259 | mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); |
256 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); | 260 | connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); |
257 | 261 | ||
258 | QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); | 262 | Q3VGroupBox* gb1 = new Q3VGroupBox( i18n("Profile kind specific settings"), topFrame); |
259 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); | 263 | topLayout->addMultiCellWidget(gb1, iii,iii,0,1); |
260 | ++iii; | 264 | ++iii; |
261 | 265 | ||
262 | // ****************************************** | 266 | // ****************************************** |
263 | // Profile kind specific settings | 267 | // Profile kind specific settings |
264 | { | 268 | { |
265 | // *** phone ******************************* | 269 | // *** phone ******************************* |
266 | QVGroupBox* topFrame = gb1; | 270 | Q3VGroupBox* topFrame = gb1; |
267 | phoneWidget = new QVBox( topFrame); | 271 | phoneWidget = new Q3VBox( topFrame); |
268 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); | 272 | //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); |
269 | //++iii; | 273 | //++iii; |
270 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); | 274 | mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); |
271 | QHBox* temphb = new QHBox( phoneWidget ); | 275 | Q3HBox* temphb = new Q3HBox( phoneWidget ); |
272 | new QLabel( i18n("I/O device: "), temphb ); | 276 | new QLabel( i18n("I/O device: "), temphb ); |
273 | mPhoneDevice = new QLineEdit( temphb); | 277 | mPhoneDevice = new QLineEdit( temphb); |
274 | button = new QPushButton( i18n("Help..."), temphb ); | 278 | button = new QPushButton( i18n("Help..."), temphb ); |
275 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); | 279 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); |
276 | 280 | ||
277 | 281 | ||
278 | temphb = new QHBox( phoneWidget ); | 282 | temphb = new Q3HBox( phoneWidget ); |
279 | new QLabel( i18n("Connection: "), temphb ); | 283 | new QLabel( i18n("Connection: "), temphb ); |
280 | mPhoneConnection = new QLineEdit( temphb); | 284 | mPhoneConnection = new QLineEdit( temphb); |
281 | button = new QPushButton( i18n("Help..."), temphb ); | 285 | button = new QPushButton( i18n("Help..."), temphb ); |
282 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); | 286 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); |
283 | 287 | ||
284 | 288 | ||
285 | temphb = new QHBox( phoneWidget ); | 289 | temphb = new Q3HBox( phoneWidget ); |
286 | new QLabel( i18n("Model(opt.): "), temphb ); | 290 | new QLabel( i18n("Model(opt.): "), temphb ); |
287 | mPhoneModel = new QLineEdit( temphb); | 291 | mPhoneModel = new QLineEdit( temphb); |
288 | button = new QPushButton( i18n("Help..."), temphb ); | 292 | button = new QPushButton( i18n("Help..."), temphb ); |
289 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); | 293 | connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); |
290 | 294 | ||
291 | // *** local******************************* | 295 | // *** local******************************* |
292 | localFileWidget = new QVBox( topFrame); | 296 | localFileWidget = new Q3VBox( topFrame); |
293 | //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); | 297 | //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); |
294 | //++iii; | 298 | //++iii; |
295 | temphb = new QHBox( localFileWidget ); | 299 | temphb = new Q3HBox( localFileWidget ); |
296 | 300 | ||
297 | lab = new QLabel( i18n("Local file Cal:"), temphb ); | 301 | lab = new QLabel( i18n("Local file Cal:"), temphb ); |
298 | lab = new QLabel( i18n("Local file ABook:"), temphb ); | 302 | lab = new QLabel( i18n("Local file ABook:"), temphb ); |
299 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); | 303 | lab = new QLabel( i18n("Local file PWMgr:"), temphb ); |
300 | temphb = new QHBox( localFileWidget ); | 304 | temphb = new Q3HBox( localFileWidget ); |
301 | button = new QPushButton( i18n("Choose..."), temphb ); | 305 | button = new QPushButton( i18n("Choose..."), temphb ); |
302 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); | 306 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); |
303 | button = new QPushButton( i18n("Choose..."), temphb ); | 307 | button = new QPushButton( i18n("Choose..."), temphb ); |
304 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); | 308 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) ); |
305 | button = new QPushButton( i18n("Choose..."), temphb ); | 309 | button = new QPushButton( i18n("Choose..."), temphb ); |
306 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); | 310 | connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) ); |
307 | temphb = new QHBox( localFileWidget ); | 311 | temphb = new Q3HBox( localFileWidget ); |
308 | 312 | ||
309 | mRemoteFile = new QLineEdit( temphb); | 313 | mRemoteFile = new QLineEdit( temphb); |
310 | mRemoteFileAB = new QLineEdit( temphb); | 314 | mRemoteFileAB = new QLineEdit( temphb); |
311 | mRemoteFilePWM = new QLineEdit( temphb); | 315 | mRemoteFilePWM = new QLineEdit( temphb); |
312 | mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); | 316 | mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget ); |
313 | 317 | ||
314 | 318 | ||
315 | // *** remote******************************* | 319 | // *** remote******************************* |
316 | remoteFileWidget = new QVBox( topFrame); | 320 | remoteFileWidget = new Q3VBox( topFrame); |
317 | //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); | 321 | //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); |
318 | //++iii; | 322 | //++iii; |
319 | temphb = new QHBox( remoteFileWidget ); | 323 | temphb = new Q3HBox( remoteFileWidget ); |
320 | new QLabel( i18n("Calendar:"), temphb); | 324 | new QLabel( i18n("Calendar:"), temphb); |
321 | new QLabel( i18n("AddressBook:"), temphb); | 325 | new QLabel( i18n("AddressBook:"), temphb); |
322 | new QLabel( i18n("PWManager:"), temphb); | 326 | new QLabel( i18n("PWManager:"), temphb); |
323 | 327 | ||
324 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); | 328 | lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); |
325 | temphb = new QHBox( remoteFileWidget ); | 329 | temphb = new Q3HBox( remoteFileWidget ); |
326 | mRemotePrecommand = new QLineEdit(temphb); | 330 | mRemotePrecommand = new QLineEdit(temphb); |
327 | mRemotePrecommandAB = new QLineEdit(temphb); | 331 | mRemotePrecommandAB = new QLineEdit(temphb); |
328 | mRemotePrecommandPWM = new QLineEdit(temphb); | 332 | mRemotePrecommandPWM = new QLineEdit(temphb); |
329 | 333 | ||
330 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); | 334 | lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); |
331 | temphb = new QHBox( remoteFileWidget ); | 335 | temphb = new Q3HBox( remoteFileWidget ); |
332 | mLocalTempFile = new QLineEdit(temphb); | 336 | mLocalTempFile = new QLineEdit(temphb); |
333 | mLocalTempFileAB = new QLineEdit(temphb); | 337 | mLocalTempFileAB = new QLineEdit(temphb); |
334 | mLocalTempFilePWM = new QLineEdit(temphb); | 338 | mLocalTempFilePWM = new QLineEdit(temphb); |
335 | 339 | ||
336 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); | 340 | lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); |
337 | temphb = new QHBox( remoteFileWidget ); | 341 | temphb = new Q3HBox( remoteFileWidget ); |
338 | mRemotePostcommand = new QLineEdit(temphb ); | 342 | mRemotePostcommand = new QLineEdit(temphb ); |
339 | mRemotePostcommandAB = new QLineEdit(temphb ); | 343 | mRemotePostcommandAB = new QLineEdit(temphb ); |
340 | mRemotePostcommandPWM = new QLineEdit(temphb ); | 344 | mRemotePostcommandPWM = new QLineEdit(temphb ); |
341 | mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget ); | 345 | mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget ); |
342 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); | 346 | lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); |
343 | temphb = new QHBox( remoteFileWidget ); | 347 | temphb = new Q3HBox( remoteFileWidget ); |
344 | button = new QPushButton( i18n("ssh/scp"), temphb ); | 348 | button = new QPushButton( i18n("ssh/scp"), temphb ); |
345 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); | 349 | connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); |
346 | button = new QPushButton( i18n("ftp"), temphb ); | 350 | button = new QPushButton( i18n("ftp"), temphb ); |
347 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); | 351 | connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); |
348 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); | 352 | lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); |
349 | 353 | ||
350 | // *** pi-sync******************************* | 354 | // *** pi-sync******************************* |
351 | piWidget = new QVBox( topFrame); | 355 | piWidget = new Q3VBox( topFrame); |
352 | //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); | 356 | //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); |
353 | //++iii; | 357 | //++iii; |
354 | temphb = new QHBox( piWidget ); | 358 | temphb = new Q3HBox( piWidget ); |
355 | new QLabel( i18n("Calendar:"), temphb); | 359 | new QLabel( i18n("Calendar:"), temphb); |
356 | new QLabel( i18n("AddressBook:"), temphb); | 360 | new QLabel( i18n("AddressBook:"), temphb); |
357 | new QLabel( i18n("PWManager:"), temphb); | 361 | new QLabel( i18n("PWManager:"), temphb); |
358 | 362 | ||
359 | lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); | 363 | lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); |
360 | temphb = new QHBox( piWidget ); | 364 | temphb = new Q3HBox( piWidget ); |
361 | mRemotePw = new QLineEdit(temphb); | 365 | mRemotePw = new QLineEdit(temphb); |
362 | mRemotePwAB = new QLineEdit(temphb); | 366 | mRemotePwAB = new QLineEdit(temphb); |
363 | mRemotePwPWM = new QLineEdit(temphb); | 367 | mRemotePwPWM = new QLineEdit(temphb); |
364 | 368 | ||
365 | lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); | 369 | lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); |
366 | temphb = new QHBox( piWidget ); | 370 | temphb = new Q3HBox( piWidget ); |
367 | mRemoteIP = new QLineEdit(temphb); | 371 | mRemoteIP = new QLineEdit(temphb); |
368 | mRemoteIPAB = new QLineEdit(temphb); | 372 | mRemoteIPAB = new QLineEdit(temphb); |
369 | mRemoteIPPWM = new QLineEdit(temphb); | 373 | mRemoteIPPWM = new QLineEdit(temphb); |
370 | 374 | ||
371 | lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); | 375 | lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); |
372 | temphb = new QHBox( piWidget ); | 376 | temphb = new Q3HBox( piWidget ); |
373 | mRemotePort = new QLineEdit(temphb); | 377 | mRemotePort = new QLineEdit(temphb); |
374 | mRemotePortAB = new QLineEdit(temphb); | 378 | mRemotePortAB = new QLineEdit(temphb); |
375 | mRemotePortPWM = new QLineEdit(temphb); | 379 | mRemotePortPWM = new QLineEdit(temphb); |
376 | 380 | ||
377 | lab = new QLabel( i18n("Local/remote Resource sync partners (Leave empty to not sync)"), piWidget); | 381 | lab = new QLabel( i18n("Local/remote Resource sync partners (Leave empty to not sync)"), piWidget); |
378 | mTableBox = new QHBox( piWidget ); | 382 | mTableBox = new Q3HBox( piWidget ); |
379 | mResTableKopi = new QTable( 1, 1, mTableBox ); | 383 | mResTableKopi = new Q3Table( 1, 1, mTableBox ); |
380 | mResTableKapi = new QTable( 1, 1, mTableBox ); | 384 | mResTableKapi = new Q3Table( 1, 1, mTableBox ); |
381 | mResTablePwmpi = new QTable( 1, 1, mTableBox ); | 385 | mResTablePwmpi = new Q3Table( 1, 1, mTableBox ); |
382 | mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 386 | mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
383 | mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 387 | mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
384 | mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); | 388 | mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") ); |
385 | mResTableKopi->setLeftMargin( 80 ); | 389 | mResTableKopi->setLeftMargin( 80 ); |
386 | mResTableKapi->setLeftMargin( 80 ); | 390 | mResTableKapi->setLeftMargin( 80 ); |
387 | } | 391 | } |
388 | // ****************************************** | 392 | // ****************************************** |
389 | // Profile kind specific settings END | 393 | // Profile kind specific settings END |
390 | 394 | ||
391 | } | 395 | } |
392 | 396 | ||
393 | void KSyncPrefsDialog::readResources() | 397 | void KSyncPrefsDialog::readResources() |
394 | { | 398 | { |
395 | mResourcesKopi.clear(); | 399 | mResourcesKopi.clear(); |
396 | KConfig fc(locateLocal("config","kopicalendarrc")); | 400 | KConfig fc(locateLocal("config","kopicalendarrc")); |
397 | fc.setGroup("CC"); | 401 | fc.setGroup("CC"); |
398 | int numCals = fc.readNumEntry("NumberCalendars",0 ); | 402 | int numCals = fc.readNumEntry("NumberCalendars",0 ); |
399 | int curCal = 1; | 403 | int curCal = 1; |
400 | while ( curCal <= numCals ) { | 404 | while ( curCal <= numCals ) { |
401 | QString prefix = "Cal_" +QString::number( curCal ); | 405 | QString prefix = "Cal_" +QString::number( curCal ); |
402 | QString name = fc.readEntry( prefix+"_Name", "Calendar"); | 406 | QString name = fc.readEntry( prefix+"_Name", "Calendar"); |
403 | mResourcesKopi.append( name ); | 407 | mResourcesKopi.append( name ); |
404 | ++curCal; | 408 | ++curCal; |
405 | } | 409 | } |
406 | mResTableKopi->setNumRows( mResourcesKopi.count() ); | 410 | mResTableKopi->setNumRows( mResourcesKopi.count() ); |
407 | int i; | 411 | int i; |
408 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 412 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
409 | mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); | 413 | mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] ); |
410 | } | 414 | } |
411 | 415 | ||
412 | mResourcesKapi.clear(); | 416 | mResourcesKapi.clear(); |
413 | 417 | ||
414 | KConfig conf ( locateLocal("config", "kabcrc") ); | 418 | KConfig conf ( locateLocal("config", "kabcrc") ); |
415 | 419 | ||
416 | conf.setGroup( "General" ); | 420 | conf.setGroup( "General" ); |
417 | 421 | ||
418 | QStringList keys = conf.readListEntry( "ResourceKeys" ); | 422 | QStringList keys = conf.readListEntry( "ResourceKeys" ); |
419 | //keys += conf->readListEntry( "PassiveResourceKeys" ); | 423 | //keys += conf->readListEntry( "PassiveResourceKeys" ); |
420 | 424 | ||
421 | //QString standardKey = mConfig->readEntry( "Standard" ); | 425 | //QString standardKey = mConfig->readEntry( "Standard" ); |
422 | 426 | ||
423 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { | 427 | for ( QStringList::Iterator it = keys.begin(); it != keys.end(); ++it ) { |
424 | conf.setGroup("Resource_"+ (*it) ); | 428 | conf.setGroup("Resource_"+ (*it) ); |
425 | QString name = conf.readEntry( "ResourceName" ); | 429 | QString name = conf.readEntry( "ResourceName" ); |
426 | mResourcesKapi.append( name ); | 430 | mResourcesKapi.append( name ); |
427 | } | 431 | } |
428 | mResTableKapi->setNumRows( mResourcesKapi.count() ); | 432 | mResTableKapi->setNumRows( mResourcesKapi.count() ); |
429 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 433 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
430 | mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); | 434 | mResTableKapi->verticalHeader ()->setLabel( i, mResourcesKapi[i] ); |
431 | } | 435 | } |
432 | 436 | ||
433 | 437 | ||
434 | } | 438 | } |
435 | void KSyncPrefsDialog::readFilter() | 439 | void KSyncPrefsDialog::readFilter() |
436 | { | 440 | { |
437 | mFilterKapi.clear(); | 441 | mFilterKapi.clear(); |
438 | mFilterKopi.clear(); | 442 | mFilterKopi.clear(); |
439 | KConfig cfgko(locateLocal("config","korganizerrc")); | 443 | KConfig cfgko(locateLocal("config","korganizerrc")); |
440 | KConfig cfgka(locateLocal("config","kaddressbookrc")); | 444 | KConfig cfgka(locateLocal("config","kaddressbookrc")); |
441 | cfgko.setGroup("General"); | 445 | cfgko.setGroup("General"); |
442 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); | 446 | mFilterKopi = cfgko.readListEntry("CalendarFilters"); |
443 | cfgka.setGroup("Filter"); | 447 | cfgka.setGroup("Filter"); |
444 | int count = cfgka.readNumEntry( "Count", 0 ); | 448 | int count = cfgka.readNumEntry( "Count", 0 ); |
445 | for ( int i = 0; i < count; i++ ) { | 449 | for ( int i = 0; i < count; i++ ) { |
446 | cfgka.setGroup("Filter_"+QString::number( i ) ); | 450 | cfgka.setGroup("Filter_"+QString::number( i ) ); |
447 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); | 451 | mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); |
448 | } | 452 | } |
449 | mFilterOutCal->clear(); | 453 | mFilterOutCal->clear(); |
450 | mFilterInCal->clear(); | 454 | mFilterInCal->clear(); |
451 | mFilterOutAB->clear(); | 455 | mFilterOutAB->clear(); |
452 | mFilterInAB->clear(); | 456 | mFilterInAB->clear(); |
453 | QStringList temp = mFilterKopi; | 457 | QStringList temp = mFilterKopi; |
454 | temp.prepend(i18n("No Filter") ); | 458 | temp.prepend(i18n("No Filter") ); |
455 | mFilterOutCal->insertStringList( temp ); | 459 | mFilterOutCal->insertStringList( temp ); |
456 | mFilterInCal->insertStringList( temp ); | 460 | mFilterInCal->insertStringList( temp ); |
457 | temp = mFilterKapi; | 461 | temp = mFilterKapi; |
458 | temp.prepend(i18n("No Filter") ); | 462 | temp.prepend(i18n("No Filter") ); |
459 | mFilterOutAB->insertStringList( temp ); | 463 | mFilterOutAB->insertStringList( temp ); |
460 | mFilterInAB->insertStringList( temp ); | 464 | mFilterInAB->insertStringList( temp ); |
461 | } | 465 | } |
462 | 466 | ||
463 | void KSyncPrefsDialog::slotOK() | 467 | void KSyncPrefsDialog::slotOK() |
464 | { | 468 | { |
465 | if ( mMyMachineName->text() == "undefined" ) { | 469 | if ( mMyMachineName->text() == "undefined" ) { |
466 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); | 470 | KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); |
467 | return; | 471 | return; |
468 | } | 472 | } |
469 | int i; | 473 | int i; |
470 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { | 474 | for (i = 0; i < mSyncProfileNames.count(); ++ i) { |
471 | if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { | 475 | if ( mSyncProfileNames.count( mSyncProfileNames[i]) > 1 ) { |
472 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); | 476 | KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); |
473 | return; | 477 | return; |
474 | } | 478 | } |
475 | } | 479 | } |
476 | usrWriteConfig(); | 480 | usrWriteConfig(); |
477 | QDialog::accept(); | 481 | QDialog::accept(); |
478 | } | 482 | } |
479 | void KSyncPrefsDialog::accept() | 483 | void KSyncPrefsDialog::accept() |
480 | { | 484 | { |
481 | slotOK(); | 485 | slotOK(); |
482 | } | 486 | } |
483 | void KSyncPrefsDialog::chooseFile() | 487 | void KSyncPrefsDialog::chooseFile() |
484 | { | 488 | { |
485 | QString fn = QDir::homeDirPath(); | 489 | QString fn = QDir::homeDirPath(); |
486 | 490 | ||
487 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 491 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
488 | if ( fn == "" ) | 492 | if ( fn == "" ) |
489 | return; | 493 | return; |
490 | mRemoteFile->setText( fn ); | 494 | mRemoteFile->setText( fn ); |
491 | } | 495 | } |
492 | 496 | ||
493 | void KSyncPrefsDialog::chooseFileAB() | 497 | void KSyncPrefsDialog::chooseFileAB() |
494 | { | 498 | { |
495 | QString fn = QDir::homeDirPath(); | 499 | QString fn = QDir::homeDirPath(); |
496 | 500 | ||
497 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); | 501 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.vcf)"), this ); |
498 | if ( fn == "" ) | 502 | if ( fn == "" ) |
499 | return; | 503 | return; |
500 | mRemoteFileAB->setText( fn ); | 504 | mRemoteFileAB->setText( fn ); |
501 | } | 505 | } |
502 | 506 | ||
503 | void KSyncPrefsDialog::chooseFilePWM() | 507 | void KSyncPrefsDialog::chooseFilePWM() |
504 | { | 508 | { |
505 | QString fn = QDir::homeDirPath(); | 509 | QString fn = QDir::homeDirPath(); |
506 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); | 510 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); |
507 | if ( fn == "" ) | 511 | if ( fn == "" ) |
508 | return; | 512 | return; |
509 | mRemoteFilePWM->setText( fn ); | 513 | mRemoteFilePWM->setText( fn ); |
510 | } | 514 | } |
511 | void KSyncPrefsDialog::updateMyCaption() | 515 | void KSyncPrefsDialog::updateMyCaption() |
512 | { | 516 | { |
513 | setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); | 517 | setCaption( mProfileBox->currentText() + " : " +i18n("Synchronization Preferences")); |
514 | } | 518 | } |
515 | void KSyncPrefsDialog::textChanged( const QString & s ) | 519 | void KSyncPrefsDialog::textChanged( const QString & s ) |
516 | { | 520 | { |
517 | if ( mProfileBox->count() == 0 ) | 521 | if ( mProfileBox->count() == 0 ) |
518 | return; | 522 | return; |
519 | if ( currentSelection < 3 ) { | 523 | if ( currentSelection < 3 ) { |
520 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); | 524 | //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); |
521 | mProfileBox->blockSignals( true ); | 525 | mProfileBox->blockSignals( true ); |
522 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); | 526 | mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); |
523 | mProfileBox->blockSignals( false ); | 527 | mProfileBox->blockSignals( false ); |
524 | return; | 528 | return; |
525 | } | 529 | } |
526 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); | 530 | //qDebug("cur i %d ",mProfileBox-> currentItem () ); |
527 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; | 531 | mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; |
528 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; | 532 | KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; |
529 | prof->setName( s ); | 533 | prof->setName( s ); |
530 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; | 534 | mSyncProfileNames[mProfileBox-> currentItem ()] = s; |
531 | updateMyCaption(); | 535 | updateMyCaption(); |
532 | } | 536 | } |
533 | void KSyncPrefsDialog::profileChanged( int item ) | 537 | void KSyncPrefsDialog::profileChanged( int item ) |
534 | { | 538 | { |
535 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); | 539 | //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); |
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index d8c02de..1d7503e 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h | |||
@@ -1,171 +1,171 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 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 _KSYNCPREFSDIALOG_H | 23 | #ifndef _KSYNCPREFSDIALOG_H |
24 | #define _KSYNCPREFSDIALOG_H | 24 | #define _KSYNCPREFSDIALOG_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <kdialogbase.h> | 27 | #include <kdialogbase.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | #include <qtable.h> | 29 | #include <q3table.h> |
30 | #include <qhbox.h> | 30 | #include <q3hbox.h> |
31 | 31 | ||
32 | //#include <libkdepim/kprefsdialog.h> | 32 | //#include <libkdepim/kprefsdialog.h> |
33 | 33 | ||
34 | class KColorButton; | 34 | class KColorButton; |
35 | class QSpinBox;; | 35 | class QSpinBox;; |
36 | class QRadioButton; | 36 | class QRadioButton; |
37 | class QCheckBox; | 37 | class QCheckBox; |
38 | class QSlider; | 38 | class QSlider; |
39 | class KURLRequester; | 39 | class KURLRequester; |
40 | class QComboBox; | 40 | class QComboBox; |
41 | class QButtonGroup; | 41 | class Q3ButtonGroup; |
42 | class QLineEdit; | 42 | class QLineEdit; |
43 | class QVBox; | 43 | class Q3VBox; |
44 | class QStringList; | 44 | class QStringList; |
45 | class KSyncProfile; | 45 | class KSyncProfile; |
46 | 46 | ||
47 | /** Dialog to change the korganizer configuration. | 47 | /** Dialog to change the korganizer configuration. |
48 | */ | 48 | */ |
49 | class KSyncPrefsDialog : public KDialog | 49 | class KSyncPrefsDialog : public KDialog |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | public: | 52 | public: |
53 | /** Initialize dialog and pages */ | 53 | /** Initialize dialog and pages */ |
54 | KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | 54 | KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); |
55 | ~KSyncPrefsDialog(); | 55 | ~KSyncPrefsDialog(); |
56 | void usrReadConfig(); | 56 | void usrReadConfig(); |
57 | void setLocalMachineName ( const QString& name ); | 57 | void setLocalMachineName ( const QString& name ); |
58 | QString getLocalMachineName ( ); | 58 | QString getLocalMachineName ( ); |
59 | 59 | ||
60 | QStringList getSyncProfileNames(); | 60 | QStringList getSyncProfileNames(); |
61 | 61 | ||
62 | public slots: | 62 | public slots: |
63 | protected slots: | 63 | protected slots: |
64 | void accept(); | 64 | void accept(); |
65 | void deleteProfile(); | 65 | void deleteProfile(); |
66 | void newProfile(); | 66 | void newProfile(); |
67 | void cloneProfile(); | 67 | void cloneProfile(); |
68 | void kindChanged(bool); | 68 | void kindChanged(bool); |
69 | void fillSSH(); | 69 | void fillSSH(); |
70 | void fillFTP(); | 70 | void fillFTP(); |
71 | void textChanged( const QString & ); | 71 | void textChanged( const QString & ); |
72 | void profileChanged( int ); | 72 | void profileChanged( int ); |
73 | void chooseFile(); | 73 | void chooseFile(); |
74 | void chooseFileAB(); | 74 | void chooseFileAB(); |
75 | void chooseFilePWM(); | 75 | void chooseFilePWM(); |
76 | void slotOK(); | 76 | void slotOK(); |
77 | void helpDevice(); | 77 | void helpDevice(); |
78 | void helpModel(); | 78 | void helpModel(); |
79 | void helpConnection(); | 79 | void helpConnection(); |
80 | 80 | ||
81 | protected: | 81 | protected: |
82 | void usrWriteConfig(); | 82 | void usrWriteConfig(); |
83 | void setupSyncAlgTab(); | 83 | void setupSyncAlgTab(); |
84 | void readFilter(); | 84 | void readFilter(); |
85 | void readResources(); | 85 | void readResources(); |
86 | private: | 86 | private: |
87 | void updateMyCaption(); | 87 | void updateMyCaption(); |
88 | int currentSelection; | 88 | int currentSelection; |
89 | QPtrList<KSyncProfile> mSyncProfiles; | 89 | Q3PtrList<KSyncProfile> mSyncProfiles; |
90 | QStringList mSyncProfileNames; | 90 | QStringList mSyncProfileNames; |
91 | QStringList mFilterKapi; | 91 | QStringList mFilterKapi; |
92 | QStringList mFilterKopi; | 92 | QStringList mFilterKopi; |
93 | QStringList mResourcesKopi; | 93 | QStringList mResourcesKopi; |
94 | QStringList mResourcesKapi; | 94 | QStringList mResourcesKapi; |
95 | QLineEdit * mMyMachineName; | 95 | QLineEdit * mMyMachineName; |
96 | QComboBox * mProfileBox; | 96 | QComboBox * mProfileBox; |
97 | QRadioButton* mIsLocal; | 97 | QRadioButton* mIsLocal; |
98 | QRadioButton* mIsNotLocal; | 98 | QRadioButton* mIsNotLocal; |
99 | QRadioButton* mIsPhone; | 99 | QRadioButton* mIsPhone; |
100 | QRadioButton* mIsPi; | 100 | QRadioButton* mIsPi; |
101 | QRadioButton* mIsPiSpecific; | 101 | QRadioButton* mIsPiSpecific; |
102 | QCheckBox* mIncludeInRing; | 102 | QCheckBox* mIncludeInRing; |
103 | QCheckBox* mIncludeInRingAB; | 103 | QCheckBox* mIncludeInRingAB; |
104 | QCheckBox* mIncludeInRingPWM; | 104 | QCheckBox* mIncludeInRingPWM; |
105 | void addProfile ( KSyncProfile* ); | 105 | void addProfile ( KSyncProfile* ); |
106 | void insertProfiles(); | 106 | void insertProfiles(); |
107 | void saveProfile(); | 107 | void saveProfile(); |
108 | QButtonGroup* proGr; | 108 | Q3ButtonGroup* proGr; |
109 | QHBox * mTableBox; | 109 | Q3HBox * mTableBox; |
110 | QTable* mResTableKopi; | 110 | Q3Table* mResTableKopi; |
111 | QTable* mResTableKapi; | 111 | Q3Table* mResTableKapi; |
112 | QTable* mResTablePwmpi; | 112 | Q3Table* mResTablePwmpi; |
113 | 113 | ||
114 | QComboBox * mFilterOutCal; | 114 | QComboBox * mFilterOutCal; |
115 | QComboBox * mFilterInCal; | 115 | QComboBox * mFilterInCal; |
116 | QComboBox * mFilterOutAB; | 116 | QComboBox * mFilterOutAB; |
117 | QComboBox * mFilterInAB; | 117 | QComboBox * mFilterInAB; |
118 | 118 | ||
119 | QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; | 119 | QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; |
120 | 120 | ||
121 | 121 | ||
122 | QLineEdit * mRemotePostcommand; | 122 | QLineEdit * mRemotePostcommand; |
123 | QLineEdit * mRemotePrecommand; | 123 | QLineEdit * mRemotePrecommand; |
124 | QLineEdit * mRemoteFile; | 124 | QLineEdit * mRemoteFile; |
125 | QLineEdit * mLocalTempFile; | 125 | QLineEdit * mLocalTempFile; |
126 | 126 | ||
127 | QLineEdit * mRemotePostcommandAB; | 127 | QLineEdit * mRemotePostcommandAB; |
128 | QLineEdit * mRemotePrecommandAB; | 128 | QLineEdit * mRemotePrecommandAB; |
129 | QLineEdit * mRemoteFileAB; | 129 | QLineEdit * mRemoteFileAB; |
130 | QLineEdit * mLocalTempFileAB; | 130 | QLineEdit * mLocalTempFileAB; |
131 | 131 | ||
132 | QLineEdit * mRemotePostcommandPWM; | 132 | QLineEdit * mRemotePostcommandPWM; |
133 | QLineEdit * mRemotePrecommandPWM; | 133 | QLineEdit * mRemotePrecommandPWM; |
134 | QLineEdit * mRemoteFilePWM; | 134 | QLineEdit * mRemoteFilePWM; |
135 | QLineEdit * mLocalTempFilePWM; | 135 | QLineEdit * mLocalTempFilePWM; |
136 | 136 | ||
137 | 137 | ||
138 | QLineEdit * mRemotePw; | 138 | QLineEdit * mRemotePw; |
139 | QLineEdit * mRemoteIP; | 139 | QLineEdit * mRemoteIP; |
140 | QLineEdit * mRemotePort; | 140 | QLineEdit * mRemotePort; |
141 | 141 | ||
142 | QLineEdit * mRemotePwAB; | 142 | QLineEdit * mRemotePwAB; |
143 | QLineEdit * mRemoteIPAB; | 143 | QLineEdit * mRemoteIPAB; |
144 | QLineEdit * mRemotePortAB; | 144 | QLineEdit * mRemotePortAB; |
145 | 145 | ||
146 | QLineEdit * mRemotePwPWM; | 146 | QLineEdit * mRemotePwPWM; |
147 | QLineEdit * mRemoteIPPWM; | 147 | QLineEdit * mRemoteIPPWM; |
148 | QLineEdit * mRemotePortPWM; | 148 | QLineEdit * mRemotePortPWM; |
149 | 149 | ||
150 | QLineEdit * mPhoneDevice; | 150 | QLineEdit * mPhoneDevice; |
151 | QLineEdit * mPhoneConnection; | 151 | QLineEdit * mPhoneConnection; |
152 | QLineEdit * mPhoneModel; | 152 | QLineEdit * mPhoneModel; |
153 | 153 | ||
154 | QWidget* mSetupSyncAlgTab; | 154 | QWidget* mSetupSyncAlgTab; |
155 | QVBox* localFileWidget; | 155 | Q3VBox* localFileWidget; |
156 | QVBox* remoteFileWidget; | 156 | Q3VBox* remoteFileWidget; |
157 | QVBox* phoneWidget; | 157 | Q3VBox* phoneWidget; |
158 | QVBox* piWidget; | 158 | Q3VBox* piWidget; |
159 | QCheckBox* mWriteBackFile; | 159 | QCheckBox* mWriteBackFile; |
160 | QCheckBox* mWriteBackFuture; | 160 | QCheckBox* mWriteBackFuture; |
161 | QSpinBox* mWriteBackFutureWeeks; | 161 | QSpinBox* mWriteBackFutureWeeks; |
162 | QSpinBox* mWriteBackPastWeeks; | 162 | QSpinBox* mWriteBackPastWeeks; |
163 | QCheckBox* mWriteBackExisting; | 163 | QCheckBox* mWriteBackExisting; |
164 | QCheckBox* mAskForPreferences; | 164 | QCheckBox* mAskForPreferences; |
165 | QCheckBox* mShowSummaryAfterSync; | 165 | QCheckBox* mShowSummaryAfterSync; |
166 | QCheckBox* mWriteContactToSIM; | 166 | QCheckBox* mWriteContactToSIM; |
167 | QCheckBox* mIsKapiFileL; | 167 | QCheckBox* mIsKapiFileL; |
168 | QCheckBox* mIsKapiFileR; | 168 | QCheckBox* mIsKapiFileR; |
169 | }; | 169 | }; |
170 | 170 | ||
171 | #endif | 171 | #endif |
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 91fcfc5..1e41662 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h | |||
@@ -1,87 +1,87 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef _KSYNCPROFILE_H | 20 | #ifndef _KSYNCPROFILE_H |
21 | #define _KSYNCPROFILE_H | 21 | #define _KSYNCPROFILE_H |
22 | 22 | ||
23 | #include <qptrlist.h> | 23 | #include <q3ptrlist.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qfont.h> | 25 | #include <qfont.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | 29 | ||
30 | #include <libkcal/syncdefines.h> | 30 | #include <libkcal/syncdefines.h> |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | class KConfig; | 34 | class KConfig; |
35 | 35 | ||
36 | 36 | ||
37 | class KSyncProfile : public QObject { | 37 | class KSyncProfile : public QObject { |
38 | public: | 38 | public: |
39 | KSyncProfile(); | 39 | KSyncProfile(); |
40 | ~KSyncProfile() ; | 40 | ~KSyncProfile() ; |
41 | 41 | ||
42 | KSyncProfile* clone(); | 42 | KSyncProfile* clone(); |
43 | void setDefault(); | 43 | void setDefault(); |
44 | void readConfig(KConfig *); | 44 | void readConfig(KConfig *); |
45 | void writeConfig(KConfig *); | 45 | void writeConfig(KConfig *); |
46 | void deleteConfig(KConfig *); | 46 | void deleteConfig(KConfig *); |
47 | 47 | ||
48 | void setRemotePw( const QString& n ) {mRemotePw = n;} | 48 | void setRemotePw( const QString& n ) {mRemotePw = n;} |
49 | QString getRemotePw( ) { return mRemotePw; } | 49 | QString getRemotePw( ) { return mRemotePw; } |
50 | void setRemotePwAB( const QString& n ) {mRemotePwAB = n;} | 50 | void setRemotePwAB( const QString& n ) {mRemotePwAB = n;} |
51 | QString getRemotePwAB( ) { return mRemotePwAB; } | 51 | QString getRemotePwAB( ) { return mRemotePwAB; } |
52 | void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;} | 52 | void setRemotePwPWM( const QString& n ) {mRemotePwPWM = n;} |
53 | QString getRemotePwPWM( ) { return mRemotePwPWM; } | 53 | QString getRemotePwPWM( ) { return mRemotePwPWM; } |
54 | 54 | ||
55 | void setRemoteIP( const QString& n ) {mRemoteIP = n;} | 55 | void setRemoteIP( const QString& n ) {mRemoteIP = n;} |
56 | QString getRemoteIP( ) { return mRemoteIP; } | 56 | QString getRemoteIP( ) { return mRemoteIP; } |
57 | void setRemoteIPAB( const QString& n ) {mRemoteIPAB = n;} | 57 | void setRemoteIPAB( const QString& n ) {mRemoteIPAB = n;} |
58 | QString getRemoteIPAB( ) { return mRemoteIPAB; } | 58 | QString getRemoteIPAB( ) { return mRemoteIPAB; } |
59 | void setRemoteIPPWM( const QString& n ) {mRemoteIPPWM = n;} | 59 | void setRemoteIPPWM( const QString& n ) {mRemoteIPPWM = n;} |
60 | QString getRemoteIPPWM( ) { return mRemoteIPPWM; } | 60 | QString getRemoteIPPWM( ) { return mRemoteIPPWM; } |
61 | 61 | ||
62 | void setRemotePort( const QString& n ) {mRemotePort = n;} | 62 | void setRemotePort( const QString& n ) {mRemotePort = n;} |
63 | QString getRemotePort( ) { return mRemotePort; } | 63 | QString getRemotePort( ) { return mRemotePort; } |
64 | void setRemotePortAB( const QString& n ) {mRemotePortAB = n;} | 64 | void setRemotePortAB( const QString& n ) {mRemotePortAB = n;} |
65 | QString getRemotePortAB( ) { return mRemotePortAB; } | 65 | QString getRemotePortAB( ) { return mRemotePortAB; } |
66 | void setRemotePortPWM( const QString& n ) {mRemotePortPWM = n;} | 66 | void setRemotePortPWM( const QString& n ) {mRemotePortPWM = n;} |
67 | QString getRemotePortPWM( ) { return mRemotePortPWM; } | 67 | QString getRemotePortPWM( ) { return mRemotePortPWM; } |
68 | 68 | ||
69 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} | 69 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} |
70 | QString getPreSyncCommand( ) { return mPreSyncCommand; } | 70 | QString getPreSyncCommand( ) { return mPreSyncCommand; } |
71 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} | 71 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} |
72 | QString getPostSyncCommand( ) { return mPostSyncCommand;} | 72 | QString getPostSyncCommand( ) { return mPostSyncCommand;} |
73 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} | 73 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} |
74 | QString getLocalTempFile( ) { return mLocalTempFile;} | 74 | QString getLocalTempFile( ) { return mLocalTempFile;} |
75 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} | 75 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} |
76 | QString getRemoteFileName( ) { return mRemoteFileName;} | 76 | QString getRemoteFileName( ) { return mRemoteFileName;} |
77 | 77 | ||
78 | void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} | 78 | void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} |
79 | QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } | 79 | QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } |
80 | void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} | 80 | void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} |
81 | QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} | 81 | QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} |
82 | void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} | 82 | void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} |
83 | QString getLocalTempFileAB( ) { return mLocalTempFileAB;} | 83 | QString getLocalTempFileAB( ) { return mLocalTempFileAB;} |
84 | void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} | 84 | void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} |
85 | QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} | 85 | QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} |
86 | 86 | ||
87 | void setPreSyncCommandPWM( const QString& n ) {mPreSyncCommandPWM = n;} | 87 | void setPreSyncCommandPWM( const QString& n ) {mPreSyncCommandPWM = n;} |
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 7160d0e..fb27311 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro | |||
@@ -1,76 +1,78 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | DEFINES +=KORG_NOKABC | 3 | DEFINES +=KORG_NOKABC |
4 | TARGET = microkdepim | 4 | TARGET = xmicrokdepim |
5 | INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . .. | 5 | INCLUDEPATH += ../microkde ../microkde/kdecore ../microkde/kdeui . .. |
6 | DESTDIR=../bin | 6 | DESTDIR=../bin |
7 | 7 | ||
8 | DEFINES += DESKTOP_VERSION | 8 | DEFINES += DESKTOP_VERSION |
9 | include( ../variables.pri ) | 9 | include( ../variables.pri ) |
10 | unix : { | 10 | unix : { |
11 | OBJECTS_DIR = obj/unix | 11 | OBJECTS_DIR = obj/unix |
12 | MOC_DIR = moc/unix | 12 | MOC_DIR = moc/unix |
13 | } | 13 | } |
14 | win32: { | 14 | win32: { |
15 | DEFINES += _WIN32_ | 15 | DEFINES += _WIN32_ |
16 | OBJECTS_DIR = obj/win | 16 | OBJECTS_DIR = obj/win |
17 | MOC_DIR = moc/win | 17 | MOC_DIR = moc/win |
18 | } | 18 | } |
19 | INTERFACES = \ | 19 | INTERFACES = \ |
20 | 20 | ||
21 | HEADERS = \ | 21 | HEADERS = \ |
22 | categoryeditdialog.h \ | 22 | categoryeditdialog.h \ |
23 | categoryeditdialog_base.h \ | 23 | categoryeditdialog_base.h \ |
24 | categoryselectdialog.h \ | 24 | categoryselectdialog.h \ |
25 | categoryselectdialog_base.h \ | 25 | categoryselectdialog_base.h \ |
26 | externalapphandler.h \ | 26 | externalapphandler.h \ |
27 | kdateedit.h \ | 27 | kdateedit.h \ |
28 | kdatepicker.h \ | 28 | kdatepicker.h \ |
29 | kinputdialog.h \ | 29 | kinputdialog.h \ |
30 | kpimprefs.h \ | 30 | kpimprefs.h \ |
31 | kpimglobalprefs.h \ | 31 | kpimglobalprefs.h \ |
32 | kprefsdialog.h \ | 32 | kprefsdialog.h \ |
33 | kprefswidget.h \ | 33 | kprefswidget.h \ |
34 | ksyncmanager.h \ | 34 | ksyncmanager.h \ |
35 | ksyncprofile.h \ | 35 | ksyncprofile.h \ |
36 | ksyncprefsdialog.h \ | 36 | ksyncprefsdialog.h \ |
37 | kcmconfigs/kcmkdepimconfig.h \ | 37 | kcmconfigs/kcmkdepimconfig.h \ |
38 | kcmconfigs/kdepimconfigwidget.h \ | 38 | kcmconfigs/kdepimconfigwidget.h \ |
39 | phoneaccess.h | 39 | phoneaccess.h |
40 | 40 | ||
41 | SOURCES = \ | 41 | SOURCES = \ |
42 | categoryeditdialog.cpp \ | 42 | categoryeditdialog.cpp \ |
43 | categoryeditdialog_base.cpp \ | 43 | categoryeditdialog_base.cpp \ |
44 | categoryselectdialog.cpp \ | 44 | categoryselectdialog.cpp \ |
45 | categoryselectdialog_base.cpp \ | 45 | categoryselectdialog_base.cpp \ |
46 | externalapphandler.cpp \ | 46 | externalapphandler.cpp \ |
47 | kdateedit.cpp \ | 47 | kdateedit.cpp \ |
48 | kdatepicker.cpp \ | 48 | kdatepicker.cpp \ |
49 | kinputdialog.cpp \ | 49 | kinputdialog.cpp \ |
50 | kpimprefs.cpp \ | 50 | kpimprefs.cpp \ |
51 | kpimglobalprefs.cpp \ | 51 | kpimglobalprefs.cpp \ |
52 | kprefsdialog.cpp \ | 52 | kprefsdialog.cpp \ |
53 | kprefswidget.cpp \ | 53 | kprefswidget.cpp \ |
54 | ksyncmanager.cpp \ | 54 | ksyncmanager.cpp \ |
55 | ksyncprofile.cpp \ | 55 | ksyncprofile.cpp \ |
56 | ksyncprefsdialog.cpp \ | 56 | ksyncprefsdialog.cpp \ |
57 | kcmconfigs/kcmkdepimconfig.cpp \ | 57 | kcmconfigs/kcmkdepimconfig.cpp \ |
58 | kcmconfigs/kdepimconfigwidget.cpp \ | 58 | kcmconfigs/kdepimconfigwidget.cpp \ |
59 | phoneaccess.cpp | 59 | phoneaccess.cpp |
60 | 60 | ||
61 | win32: { | 61 | win32: { |
62 | 62 | ||
63 | #olimport section | 63 | #olimport section |
64 | importol { | 64 | importol { |
65 | debug: { | 65 | debug: { |
66 | LIBS += mfc71ud.lib | 66 | LIBS += mfc71ud.lib |
67 | } | 67 | } |
68 | release: { | 68 | release: { |
69 | LIBS += mfc71u.lib | 69 | LIBS += mfc71u.lib |
70 | } | 70 | } |
71 | DEFINES += _OL_IMPORT_ | 71 | DEFINES += _OL_IMPORT_ |
72 | HEADERS += ol_access.h | 72 | HEADERS += ol_access.h |
73 | SOURCES += ol_access.cpp | 73 | SOURCES += ol_access.cpp |
74 | #olimport section end | 74 | #olimport section end |
75 | } | 75 | } |
76 | } | 76 | } |
77 | #The following line was inserted by qt3to4 | ||
78 | QT += xml qt3support | ||
diff --git a/libkdepim/libkdepimE.pro b/libkdepim/libkdepimE.pro index f3db68e..4b42184 100644 --- a/libkdepim/libkdepimE.pro +++ b/libkdepim/libkdepimE.pro | |||
@@ -1,57 +1,57 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkdepim | 3 | TARGET = xmicrokdepim |
4 | INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include | 4 | INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/microkde $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include |
5 | LIBS += -lmicrokde | 5 | LIBS += -lxmicrokde |
6 | #LIBS += -lmicrokcal | 6 | #LIBS += -lxmicrokcal |
7 | LIBS += -L$(QPEDIR)/lib | 7 | LIBS += -L$(QPEDIR)/lib |
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR=$(QPEDIR)/lib | 10 | DESTDIR=$(QPEDIR)/lib |
11 | 11 | ||
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | categoryeditdialog.h \ | 16 | categoryeditdialog.h \ |
17 | categoryeditdialog_base.h \ | 17 | categoryeditdialog_base.h \ |
18 | categoryselectdialog.h \ | 18 | categoryselectdialog.h \ |
19 | categoryselectdialog_base.h \ | 19 | categoryselectdialog_base.h \ |
20 | externalapphandler.h \ | 20 | externalapphandler.h \ |
21 | kdateedit.h \ | 21 | kdateedit.h \ |
22 | kdatepicker.h \ | 22 | kdatepicker.h \ |
23 | kinputdialog.h \ | 23 | kinputdialog.h \ |
24 | kpimprefs.h \ | 24 | kpimprefs.h \ |
25 | kpimglobalprefs.h \ | 25 | kpimglobalprefs.h \ |
26 | kprefsdialog.h \ | 26 | kprefsdialog.h \ |
27 | kprefswidget.h \ | 27 | kprefswidget.h \ |
28 | ksyncmanager.h \ | 28 | ksyncmanager.h \ |
29 | ksyncprofile.h \ | 29 | ksyncprofile.h \ |
30 | ksyncprefsdialog.h \ | 30 | ksyncprefsdialog.h \ |
31 | kcmconfigs/kcmkdepimconfig.h \ | 31 | kcmconfigs/kcmkdepimconfig.h \ |
32 | kcmconfigs/kdepimconfigwidget.h \ | 32 | kcmconfigs/kdepimconfigwidget.h \ |
33 | phoneaccess.h | 33 | phoneaccess.h |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | SOURCES = \ | 37 | SOURCES = \ |
38 | categoryeditdialog.cpp \ | 38 | categoryeditdialog.cpp \ |
39 | categoryeditdialog_base.cpp \ | 39 | categoryeditdialog_base.cpp \ |
40 | categoryselectdialog.cpp \ | 40 | categoryselectdialog.cpp \ |
41 | categoryselectdialog_base.cpp \ | 41 | categoryselectdialog_base.cpp \ |
42 | externalapphandler.cpp \ | 42 | externalapphandler.cpp \ |
43 | kdateedit.cpp \ | 43 | kdateedit.cpp \ |
44 | kinputdialog.cpp \ | 44 | kinputdialog.cpp \ |
45 | kdatepicker.cpp \ | 45 | kdatepicker.cpp \ |
46 | kpimprefs.cpp \ | 46 | kpimprefs.cpp \ |
47 | kpimglobalprefs.cpp \ | 47 | kpimglobalprefs.cpp \ |
48 | kprefsdialog.cpp \ | 48 | kprefsdialog.cpp \ |
49 | kprefswidget.cpp \ | 49 | kprefswidget.cpp \ |
50 | ksyncmanager.cpp \ | 50 | ksyncmanager.cpp \ |
51 | ksyncprofile.cpp \ | 51 | ksyncprofile.cpp \ |
52 | ksyncprefsdialog.cpp \ | 52 | ksyncprefsdialog.cpp \ |
53 | kcmconfigs/kcmkdepimconfig.cpp \ | 53 | kcmconfigs/kcmkdepimconfig.cpp \ |
54 | kcmconfigs/kdepimconfigwidget.cpp \ | 54 | kcmconfigs/kdepimconfigwidget.cpp \ |
55 | phoneaccess.cpp | 55 | phoneaccess.cpp |
56 | 56 | ||
57 | 57 | ||
diff --git a/libkdepim/ol_access.cpp b/libkdepim/ol_access.cpp index 1b05693..821f148 100755 --- a/libkdepim/ol_access.cpp +++ b/libkdepim/ol_access.cpp | |||
@@ -1,240 +1,240 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2006 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2006 Lutz Rogowski <rogowski@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 <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qframe.h> | 25 | #include <q3frame.h> |
26 | #include <qpixmap.h> | 26 | #include <qpixmap.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qprogressbar.h> | 28 | #include <q3progressbar.h> |
29 | #include <qprogressdialog.h> | 29 | #include <q3progressdialog.h> |
30 | #include <qwidgetstack.h> | 30 | #include <q3widgetstack.h> |
31 | #include <qdatetime.h> | 31 | #include <qdatetime.h> |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qapplication.h> | 35 | #include <qapplication.h> |
36 | #include <qhbox.h> | 36 | #include <q3hbox.h> |
37 | #include <qheader.h> | 37 | #include <q3header.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qlistview.h> | 39 | #include <q3listview.h> |
40 | 40 | ||
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | #include <kstandarddirs.h> | 43 | #include <kstandarddirs.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | #include <kfiledialog.h> | 45 | #include <kfiledialog.h> |
46 | #include <kstaticdeleter.h> | 46 | #include <kstaticdeleter.h> |
47 | #include <kdialogbase.h> | 47 | #include <kdialogbase.h> |
48 | 48 | ||
49 | 49 | ||
50 | #include <ol_access.h> | 50 | #include <ol_access.h> |
51 | 51 | ||
52 | #include "../outport/msoutl9.h" | 52 | #include "../outport/msoutl9.h" |
53 | #include <ole2.h> | 53 | #include <ole2.h> |
54 | #include <comutil.h> | 54 | #include <comutil.h> |
55 | 55 | ||
56 | 56 | ||
57 | class OLEListViewItem : public QCheckListItem | 57 | class OLEListViewItem : public Q3CheckListItem |
58 | { | 58 | { |
59 | public: | 59 | public: |
60 | OLEListViewItem( QListView *parent, QString text ) : | 60 | OLEListViewItem( Q3ListView *parent, QString text ) : |
61 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; | 61 | Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { ; }; |
62 | OLEListViewItem( QListViewItem *after, QString text ) : | 62 | OLEListViewItem( Q3ListViewItem *after, QString text ) : |
63 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; | 63 | Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { ; }; |
64 | ~OLEListViewItem() {}; | 64 | ~OLEListViewItem() {}; |
65 | void setData( DWORD data ) {mData= data; }; | 65 | void setData( DWORD data ) {mData= data; }; |
66 | void setDataID( QString data ){ mDataID = data ;} | 66 | void setDataID( QString data ){ mDataID = data ;} |
67 | QString dataID() { return mDataID;} | 67 | QString dataID() { return mDataID;} |
68 | DWORD data() { return mData ;}; | 68 | DWORD data() { return mData ;}; |
69 | private: | 69 | private: |
70 | DWORD mData; | 70 | DWORD mData; |
71 | QString mDataID; | 71 | QString mDataID; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | class OLEFolderSelect : public KDialogBase | 74 | class OLEFolderSelect : public KDialogBase |
75 | { | 75 | { |
76 | public: | 76 | public: |
77 | OLEFolderSelect() : | 77 | OLEFolderSelect() : |
78 | KDialogBase( Plain, "", Ok | Cancel, Ok, | 78 | KDialogBase( Plain, "", Ok | Cancel, Ok, |
79 | 0, "", true, false, i18n("Import!") ) | 79 | 0, "", true, false, i18n("Import!") ) |
80 | { | 80 | { |
81 | QHBox * mw = new QHBox( this ); | 81 | Q3HBox * mw = new Q3HBox( this ); |
82 | setMainWidget( mw ); | 82 | setMainWidget( mw ); |
83 | mListView = new QListView( mw ); | 83 | mListView = new Q3ListView( mw ); |
84 | mListView->addColumn(i18n("Select Folder")); | 84 | mListView->addColumn(i18n("Select Folder")); |
85 | mListView->addColumn(i18n("Content Type")); | 85 | mListView->addColumn(i18n("Content Type")); |
86 | } | 86 | } |
87 | QListView* listView() { return mListView;} | 87 | Q3ListView* listView() { return mListView;} |
88 | private: | 88 | private: |
89 | QListView* mListView; | 89 | Q3ListView* mListView; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | OL_access *OL_access::sInstance = 0; | 92 | OL_access *OL_access::sInstance = 0; |
93 | static KStaticDeleter<OL_access> staticDeleterPim; | 93 | static KStaticDeleter<OL_access> staticDeleterPim; |
94 | 94 | ||
95 | OL_access *OL_access::instance() | 95 | OL_access *OL_access::instance() |
96 | { | 96 | { |
97 | if ( !sInstance ) { | 97 | if ( !sInstance ) { |
98 | sInstance = staticDeleterPim.setObject( new OL_access() ); | 98 | sInstance = staticDeleterPim.setObject( new OL_access() ); |
99 | } | 99 | } |
100 | return sInstance; | 100 | return sInstance; |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | OL_access::OL_access() | 104 | OL_access::OL_access() |
105 | { | 105 | { |
106 | mErrorInit = true; | 106 | mErrorInit = true; |
107 | SCODE sc = ::OleInitialize(NULL); | 107 | SCODE sc = ::OleInitialize(NULL); |
108 | if ( FAILED ( sc ) ) { | 108 | if ( FAILED ( sc ) ) { |
109 | KMessageBox::information( 0 ,i18n("OLE initialisation failed" )); | 109 | KMessageBox::information( 0 ,i18n("OLE initialisation failed" )); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ | 112 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ |
113 | KMessageBox::information( 0, i18n("Sorry, cannot access Outlook") ); | 113 | KMessageBox::information( 0, i18n("Sorry, cannot access Outlook") ); |
114 | return ; | 114 | return ; |
115 | } | 115 | } |
116 | mErrorInit = false; | 116 | mErrorInit = false; |
117 | } | 117 | } |
118 | OL_access::~OL_access() | 118 | OL_access::~OL_access() |
119 | { | 119 | { |
120 | if (sInstance == this) | 120 | if (sInstance == this) |
121 | sInstance = staticDeleterPim.setObject(0); | 121 | sInstance = staticDeleterPim.setObject(0); |
122 | } | 122 | } |
123 | 123 | ||
124 | KABC::Addressee::List OL_access::importOLcontacts() | 124 | KABC::Addressee::List OL_access::importOLcontacts() |
125 | { | 125 | { |
126 | KABC::Addressee::List retval; | 126 | KABC::Addressee::List retval; |
127 | if ( mErrorInit ) | 127 | if ( mErrorInit ) |
128 | return retval; | 128 | return retval; |
129 | QStringList folderList = getFolderSelection( OL_CONTACT_DATA , i18n("Select Folders to import")); | 129 | QStringList folderList = getFolderSelection( OL_CONTACT_DATA , i18n("Select Folders to import")); |
130 | int numFolders = folderList.count()/2; | 130 | int numFolders = folderList.count()/2; |
131 | int i; | 131 | int i; |
132 | for ( i = 0; i < numFolders; ++i ) { | 132 | for ( i = 0; i < numFolders; ++i ) { |
133 | readContactData( getFolderFromID( 0, folderList[(i*2)+1] ) , &retval, false ); | 133 | readContactData( getFolderFromID( 0, folderList[(i*2)+1] ) , &retval, false ); |
134 | } | 134 | } |
135 | KMessageBox::information( 0, i18n("%1 contacts read").arg( retval.count() ) ); | 135 | KMessageBox::information( 0, i18n("%1 contacts read").arg( retval.count() ) ); |
136 | return retval; | 136 | return retval; |
137 | } | 137 | } |
138 | void OL_access::readContactData( LPDISPATCH dispItem, KABC::Addressee::List* list, bool syncMode ) | 138 | void OL_access::readContactData( LPDISPATCH dispItem, KABC::Addressee::List* list, bool syncMode ) |
139 | { | 139 | { |
140 | dispItem->AddRef(); | 140 | dispItem->AddRef(); |
141 | MAPIFolder mf(dispItem); | 141 | MAPIFolder mf(dispItem); |
142 | mf.m_lpDispatch->AddRef(); | 142 | mf.m_lpDispatch->AddRef(); |
143 | _Items folderItems; | 143 | _Items folderItems; |
144 | _variant_t indx((long)0); | 144 | _variant_t indx((long)0); |
145 | LPDISPATCH itm; | 145 | LPDISPATCH itm; |
146 | int i; | 146 | int i; |
147 | folderItems = mf.GetItems(); | 147 | folderItems = mf.GetItems(); |
148 | QString cap = i18n("Importing contact data"); | 148 | QString cap = i18n("Importing contact data"); |
149 | if ( syncMode ) { | 149 | if ( syncMode ) { |
150 | cap = i18n("Reading contact data..."); | 150 | cap = i18n("Reading contact data..."); |
151 | } | 151 | } |
152 | QProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(), 0 ); | 152 | Q3ProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(), 0 ); |
153 | bar.setCaption (i18n("Accessing OL") ); | 153 | bar.setCaption (i18n("Accessing OL") ); |
154 | int h = bar.sizeHint().height() ; | 154 | int h = bar.sizeHint().height() ; |
155 | int w = 300; | 155 | int w = 300; |
156 | int dw = QApplication::desktop()->width(); | 156 | int dw = QApplication::desktop()->width(); |
157 | int dh = QApplication::desktop()->height(); | 157 | int dh = QApplication::desktop()->height(); |
158 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 158 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
159 | bar.show(); | 159 | bar.show(); |
160 | for(i=1; i <= folderItems.GetCount(); ++i) | 160 | for(i=1; i <= folderItems.GetCount(); ++i) |
161 | { | 161 | { |
162 | qApp->processEvents(); | 162 | qApp->processEvents(); |
163 | if ( ! bar.isVisible() ) | 163 | if ( ! bar.isVisible() ) |
164 | return ; | 164 | return ; |
165 | bar.setProgress( i ); | 165 | bar.setProgress( i ); |
166 | indx = (long)i; | 166 | indx = (long)i; |
167 | itm = folderItems.Item(indx.Detach()); | 167 | itm = folderItems.Item(indx.Detach()); |
168 | _ContactItem * pItem = (_ContactItem *)&itm; | 168 | _ContactItem * pItem = (_ContactItem *)&itm; |
169 | list->append( ol2kapiContact( pItem, syncMode ) ); | 169 | list->append( ol2kapiContact( pItem, syncMode ) ); |
170 | itm->Release(); | 170 | itm->Release(); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | QStringList OL_access::getFolderSelection( int type , QString caption ) | 173 | QStringList OL_access::getFolderSelection( int type , QString caption ) |
174 | { | 174 | { |
175 | OLEFolderSelect folder_dialog; | 175 | OLEFolderSelect folder_dialog; |
176 | QListView * listView = folder_dialog.listView(); | 176 | Q3ListView * listView = folder_dialog.listView(); |
177 | MAPIFolder mfInbox; | 177 | MAPIFolder mfInbox; |
178 | MAPIFolder mfRoot; | 178 | MAPIFolder mfRoot; |
179 | CString szName; | 179 | CString szName; |
180 | _NameSpace olNS; | 180 | _NameSpace olNS; |
181 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); | 181 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); |
182 | mfInbox = olNS.GetDefaultFolder(6); | 182 | mfInbox = olNS.GetDefaultFolder(6); |
183 | mfRoot = mfInbox.GetParent(); | 183 | mfRoot = mfInbox.GetParent(); |
184 | szName = mfRoot.GetName(); | 184 | szName = mfRoot.GetName(); |
185 | long iType = mfRoot.GetDefaultItemType(); | 185 | long iType = mfRoot.GetDefaultItemType(); |
186 | QString mes; | 186 | QString mes; |
187 | mes = QString::fromUcs2( szName.GetBuffer() ); | 187 | mes = QString::fromUcs2( szName.GetBuffer() ); |
188 | OLEListViewItem * root = new OLEListViewItem( listView, mes ); | 188 | OLEListViewItem * root = new OLEListViewItem( listView, mes ); |
189 | mfRoot.m_lpDispatch->AddRef(); | 189 | mfRoot.m_lpDispatch->AddRef(); |
190 | addFolder( root, mfRoot.m_lpDispatch, type ); | 190 | addFolder( root, mfRoot.m_lpDispatch, type ); |
191 | root->setOpen( true ); | 191 | root->setOpen( true ); |
192 | listView->setSortColumn( 0 ); | 192 | listView->setSortColumn( 0 ); |
193 | listView->sort( ); | 193 | listView->sort( ); |
194 | folder_dialog.setCaption( caption ); | 194 | folder_dialog.setCaption( caption ); |
195 | QStringList retval; | 195 | QStringList retval; |
196 | folder_dialog.resize( folder_dialog.sizeHint().width()+50, folder_dialog.sizeHint().height()+50 ); | 196 | folder_dialog.resize( folder_dialog.sizeHint().width()+50, folder_dialog.sizeHint().height()+50 ); |
197 | if ( folder_dialog.exec() ) { | 197 | if ( folder_dialog.exec() ) { |
198 | OLEListViewItem* child = (OLEListViewItem*) listView->firstChild(); | 198 | OLEListViewItem* child = (OLEListViewItem*) listView->firstChild(); |
199 | while ( child ) { | 199 | while ( child ) { |
200 | if ( child->isOn() && ! child->firstChild() ) { | 200 | if ( child->isOn() && ! child->firstChild() ) { |
201 | retval << child->text( 0 ); | 201 | retval << child->text( 0 ); |
202 | retval << child->dataID(); | 202 | retval << child->dataID(); |
203 | } | 203 | } |
204 | child = (OLEListViewItem*) child->itemBelow(); | 204 | child = (OLEListViewItem*) child->itemBelow(); |
205 | } | 205 | } |
206 | //KMessageBox::information(0,retval.join(" \n ")); | 206 | //KMessageBox::information(0,retval.join(" \n ")); |
207 | } | 207 | } |
208 | return retval; | 208 | return retval; |
209 | } | 209 | } |
210 | void OL_access::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent, long fType) | 210 | void OL_access::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent, long fType) |
211 | { | 211 | { |
212 | MAPIFolder mfParent(dispParent), mfChild; | 212 | MAPIFolder mfParent(dispParent), mfChild; |
213 | _Folders folders; | 213 | _Folders folders; |
214 | _variant_t fndx((long)0); | 214 | _variant_t fndx((long)0); |
215 | CString szName; | 215 | CString szName; |
216 | long iType; | 216 | long iType; |
217 | OLEListViewItem* hChild; | 217 | OLEListViewItem* hChild; |
218 | 218 | ||
219 | folders = mfParent.GetFolders(); | 219 | folders = mfParent.GetFolders(); |
220 | for(int i=1; i <= folders.GetCount(); ++i) | 220 | for(int i=1; i <= folders.GetCount(); ++i) |
221 | { | 221 | { |
222 | iParent->setEnabled( true ); | 222 | iParent->setEnabled( true ); |
223 | fndx = (long)i; | 223 | fndx = (long)i; |
224 | mfChild = folders.Item(fndx.Detach()); | 224 | mfChild = folders.Item(fndx.Detach()); |
225 | mfChild.m_lpDispatch->AddRef(); | 225 | mfChild.m_lpDispatch->AddRef(); |
226 | szName = mfChild.GetName(); | 226 | szName = mfChild.GetName(); |
227 | iType = mfChild.GetDefaultItemType(); | 227 | iType = mfChild.GetDefaultItemType(); |
228 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); | 228 | hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); |
229 | hChild->setDataID( QString::fromUcs2(mfChild.GetEntryID().GetBuffer()) ); | 229 | hChild->setDataID( QString::fromUcs2(mfChild.GetEntryID().GetBuffer()) ); |
230 | if ( iType != fType) | 230 | if ( iType != fType) |
231 | hChild->setEnabled( false ); | 231 | hChild->setEnabled( false ); |
232 | QString ts; | 232 | QString ts; |
233 | switch( iType ) { | 233 | switch( iType ) { |
234 | case 0: | 234 | case 0: |
235 | ts = i18n("Mail"); | 235 | ts = i18n("Mail"); |
236 | break; | 236 | break; |
237 | case 1: | 237 | case 1: |
238 | ts = i18n("Calendar"); | 238 | ts = i18n("Calendar"); |
239 | break; | 239 | break; |
240 | case 2: | 240 | case 2: |
@@ -1074,155 +1074,155 @@ KABC::Addressee OL_access::ol2kapiContact( _ContactItem * aItem , bool syncMode) | |||
1074 | } | 1074 | } |
1075 | tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); | 1075 | tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); |
1076 | phoneS.replace( QRegExp("\\r"), ""); | 1076 | phoneS.replace( QRegExp("\\r"), ""); |
1077 | if ( ! tempAdd.isEmpty() ) { | 1077 | if ( ! tempAdd.isEmpty() ) { |
1078 | additionalInfo += i18n("\nUser2: "); | 1078 | additionalInfo += i18n("\nUser2: "); |
1079 | additionalInfo += tempAdd;; | 1079 | additionalInfo += tempAdd;; |
1080 | } | 1080 | } |
1081 | tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); | 1081 | tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); |
1082 | phoneS.replace( QRegExp("\\r"), ""); | 1082 | phoneS.replace( QRegExp("\\r"), ""); |
1083 | if ( ! tempAdd.isEmpty() ) { | 1083 | if ( ! tempAdd.isEmpty() ) { |
1084 | additionalInfo += i18n("\nUser3: "); | 1084 | additionalInfo += i18n("\nUser3: "); |
1085 | additionalInfo += tempAdd;; | 1085 | additionalInfo += tempAdd;; |
1086 | } | 1086 | } |
1087 | tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); | 1087 | tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); |
1088 | phoneS.replace( QRegExp("\\r"), ""); | 1088 | phoneS.replace( QRegExp("\\r"), ""); |
1089 | if ( ! tempAdd.isEmpty() ) { | 1089 | if ( ! tempAdd.isEmpty() ) { |
1090 | additionalInfo += i18n("\nUser4: "); | 1090 | additionalInfo += i18n("\nUser4: "); |
1091 | additionalInfo += tempAdd;; | 1091 | additionalInfo += tempAdd;; |
1092 | } | 1092 | } |
1093 | if (!additionalInfo.isEmpty() && ! syncMode ) { | 1093 | if (!additionalInfo.isEmpty() && ! syncMode ) { |
1094 | tempAdd = notesStr; | 1094 | tempAdd = notesStr; |
1095 | notesStr = "+++++++++++++++++++++++++++\n"; | 1095 | notesStr = "+++++++++++++++++++++++++++\n"; |
1096 | notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); | 1096 | notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); |
1097 | notesStr += additionalInfo; | 1097 | notesStr += additionalInfo; |
1098 | notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); | 1098 | notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); |
1099 | notesStr += "+++++++++++++++++++++++++++\n"; | 1099 | notesStr += "+++++++++++++++++++++++++++\n"; |
1100 | notesStr += tempAdd; | 1100 | notesStr += tempAdd; |
1101 | } | 1101 | } |
1102 | addressee.setNote( notesStr ); | 1102 | addressee.setNote( notesStr ); |
1103 | #if 0 | 1103 | #if 0 |
1104 | // pending | 1104 | // pending |
1105 | - IM address: no clue where to get info about the helper ID | 1105 | - IM address: no clue where to get info about the helper ID |
1106 | -custom fields: difficult to implement - not implemented | 1106 | -custom fields: difficult to implement - not implemented |
1107 | -keys: makes no sense | 1107 | -keys: makes no sense |
1108 | #endif | 1108 | #endif |
1109 | return addressee; | 1109 | return addressee; |
1110 | } | 1110 | } |
1111 | #if 0 | 1111 | #if 0 |
1112 | 1112 | ||
1113 | 1113 | ||
1114 | QDateTime mDdate2Qdtr( DATE dt) | 1114 | QDateTime mDdate2Qdtr( DATE dt) |
1115 | { | 1115 | { |
1116 | COleDateTime odt; | 1116 | COleDateTime odt; |
1117 | SYSTEMTIME st; | 1117 | SYSTEMTIME st; |
1118 | odt = dt; | 1118 | odt = dt; |
1119 | if ( odt.GetStatus() != 0 ) | 1119 | if ( odt.GetStatus() != 0 ) |
1120 | return QDateTime(); | 1120 | return QDateTime(); |
1121 | odt.GetAsSystemTime(st); | 1121 | odt.GetAsSystemTime(st); |
1122 | if ( st.wYear > 4000 ) // this program as a year 4000 bug! | 1122 | if ( st.wYear > 4000 ) // this program as a year 4000 bug! |
1123 | return QDateTime(); | 1123 | return QDateTime(); |
1124 | // it seems so, that 1.1.4501 indicates: DATE invalid | 1124 | // it seems so, that 1.1.4501 indicates: DATE invalid |
1125 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); | 1125 | QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); |
1126 | return qdt; | 1126 | return qdt; |
1127 | } | 1127 | } |
1128 | DATE Qdt2date( QDateTime dt ) | 1128 | DATE Qdt2date( QDateTime dt ) |
1129 | { | 1129 | { |
1130 | DATE ddd; | 1130 | DATE ddd; |
1131 | COleDateTime odt; | 1131 | COleDateTime odt; |
1132 | odt.SetDateTime(dt.date().year(), dt.date().month(),dt.date().day(), | 1132 | odt.SetDateTime(dt.date().year(), dt.date().month(),dt.date().day(), |
1133 | dt.time().hour(), dt.time().minute(), dt.time().second() ); | 1133 | dt.time().hour(), dt.time().minute(), dt.time().second() ); |
1134 | ddd = odt; | 1134 | ddd = odt; |
1135 | return ddd; | 1135 | return ddd; |
1136 | } | 1136 | } |
1137 | 1137 | ||
1138 | class OLEListViewItem : public QCheckListItem | 1138 | class OLEListViewItem : public Q3CheckListItem |
1139 | { | 1139 | { |
1140 | public: | 1140 | public: |
1141 | OLEListViewItem( QListView *parent, QString text ) : | 1141 | OLEListViewItem( Q3ListView *parent, QString text ) : |
1142 | QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; | 1142 | Q3CheckListItem( parent, text, Q3CheckListItem::CheckBox ) { ; }; |
1143 | OLEListViewItem( QListViewItem *after, QString text ) : | 1143 | OLEListViewItem( Q3ListViewItem *after, QString text ) : |
1144 | QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; | 1144 | Q3CheckListItem( after, text, Q3CheckListItem::CheckBox ) { ; }; |
1145 | ~OLEListViewItem() {}; | 1145 | ~OLEListViewItem() {}; |
1146 | void setData( DWORD data ) {mData= data; }; | 1146 | void setData( DWORD data ) {mData= data; }; |
1147 | void setDataID( QString data ){ mDataID = data ;} | 1147 | void setDataID( QString data ){ mDataID = data ;} |
1148 | QString dataID() { return mDataID;} | 1148 | QString dataID() { return mDataID;} |
1149 | DWORD data() { return mData ;}; | 1149 | DWORD data() { return mData ;}; |
1150 | private: | 1150 | private: |
1151 | DWORD mData; | 1151 | DWORD mData; |
1152 | QString mDataID; | 1152 | QString mDataID; |
1153 | }; | 1153 | }; |
1154 | bool KAImportOLdialog::sOLDispatch = false; | 1154 | bool KAImportOLdialog::sOLDispatch = false; |
1155 | 1155 | ||
1156 | KAImportOLdialog::KAImportOLdialog( const QString &caption, | 1156 | KAImportOLdialog::KAImportOLdialog( const QString &caption, |
1157 | KABC::AddressBook * aBook, QWidget *parent ) : | 1157 | KABC::AddressBook * aBook, QWidget *parent ) : |
1158 | KDialogBase( Plain, caption, User1 | Close, Ok, | 1158 | KDialogBase( Plain, caption, User1 | Close, Ok, |
1159 | parent, caption, true, false, i18n("Import!") ) | 1159 | parent, caption, true, false, i18n("Import!") ) |
1160 | { | 1160 | { |
1161 | mSyncMode = false; | 1161 | mSyncMode = false; |
1162 | QHBox * mw = new QHBox( this ); | 1162 | Q3HBox * mw = new Q3HBox( this ); |
1163 | setMainWidget( mw ); | 1163 | setMainWidget( mw ); |
1164 | mListView = new QListView( mw ); | 1164 | mListView = new Q3ListView( mw ); |
1165 | mListView->addColumn(i18n("Select Folder")); | 1165 | mListView->addColumn(i18n("Select Folder")); |
1166 | mListView->addColumn(i18n("Content Type")); | 1166 | mListView->addColumn(i18n("Content Type")); |
1167 | mABook = aBook; | 1167 | mABook = aBook; |
1168 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); | 1168 | connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); |
1169 | setupFolderView(); | 1169 | setupFolderView(); |
1170 | resize( sizeHint().width()+50, sizeHint().height()+50 ); | 1170 | resize( sizeHint().width()+50, sizeHint().height()+50 ); |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | KAImportOLdialog::~KAImportOLdialog() | 1173 | KAImportOLdialog::~KAImportOLdialog() |
1174 | { | 1174 | { |
1175 | 1175 | ||
1176 | } | 1176 | } |
1177 | 1177 | ||
1178 | void KAImportOLdialog::setSyncMode() | 1178 | void KAImportOLdialog::setSyncMode() |
1179 | { | 1179 | { |
1180 | mSyncMode = true; | 1180 | mSyncMode = true; |
1181 | findButton( User1 )->setText( i18n("Synchronize!") ); | 1181 | findButton( User1 )->setText( i18n("Synchronize!") ); |
1182 | } | 1182 | } |
1183 | KABC::Addressee::List KAImportOLdialog::getAddressList() | 1183 | KABC::Addressee::List KAImportOLdialog::getAddressList() |
1184 | { | 1184 | { |
1185 | return mAList; | 1185 | return mAList; |
1186 | } | 1186 | } |
1187 | void KAImportOLdialog::setupFolderView() | 1187 | void KAImportOLdialog::setupFolderView() |
1188 | { | 1188 | { |
1189 | SCODE sc = ::OleInitialize(NULL); | 1189 | SCODE sc = ::OleInitialize(NULL); |
1190 | if ( FAILED ( sc ) ) { | 1190 | if ( FAILED ( sc ) ) { |
1191 | KMessageBox::information(this,"OLE initialisation failed"); | 1191 | KMessageBox::information(this,"OLE initialisation failed"); |
1192 | return; | 1192 | return; |
1193 | } | 1193 | } |
1194 | if( ! KAImportOLdialog::sOLDispatch ) { | 1194 | if( ! KAImportOLdialog::sOLDispatch ) { |
1195 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ | 1195 | if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ |
1196 | KMessageBox::information(this,"Sorry, cannot access Outlook"); | 1196 | KMessageBox::information(this,"Sorry, cannot access Outlook"); |
1197 | return ; | 1197 | return ; |
1198 | } | 1198 | } |
1199 | KAImportOLdialog::sOLDispatch = true; | 1199 | KAImportOLdialog::sOLDispatch = true; |
1200 | } | 1200 | } |
1201 | MAPIFolder mfInbox; | 1201 | MAPIFolder mfInbox; |
1202 | MAPIFolder mfRoot; | 1202 | MAPIFolder mfRoot; |
1203 | CString szName; | 1203 | CString szName; |
1204 | _NameSpace olNS; | 1204 | _NameSpace olNS; |
1205 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); | 1205 | olNS = gOlAppAB.GetNamespace(_T("MAPI")); |
1206 | mfInbox = olNS.GetDefaultFolder(6); | 1206 | mfInbox = olNS.GetDefaultFolder(6); |
1207 | mfRoot = mfInbox.GetParent(); | 1207 | mfRoot = mfInbox.GetParent(); |
1208 | szName = mfRoot.GetName(); | 1208 | szName = mfRoot.GetName(); |
1209 | long iType = mfRoot.GetDefaultItemType(); | 1209 | long iType = mfRoot.GetDefaultItemType(); |
1210 | QString mes; | 1210 | QString mes; |
1211 | mes = QString::fromUcs2( szName.GetBuffer() ); | 1211 | mes = QString::fromUcs2( szName.GetBuffer() ); |
1212 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); | 1212 | OLEListViewItem * root = new OLEListViewItem( mListView, mes ); |
1213 | mfRoot.m_lpDispatch->AddRef(); | 1213 | mfRoot.m_lpDispatch->AddRef(); |
1214 | addFolder( root, mfRoot.m_lpDispatch ); | 1214 | addFolder( root, mfRoot.m_lpDispatch ); |
1215 | root->setOpen( true ); | 1215 | root->setOpen( true ); |
1216 | mListView->setSortColumn( 0 ); | 1216 | mListView->setSortColumn( 0 ); |
1217 | mListView->sort( ); | 1217 | mListView->sort( ); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | 1220 | ||
1221 | void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) | 1221 | void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) |
1222 | { | 1222 | { |
1223 | MAPIFolder mfParent(dispParent), mfChild; | 1223 | MAPIFolder mfParent(dispParent), mfChild; |
1224 | _Folders folders; | 1224 | _Folders folders; |
1225 | _variant_t fndx((long)0); | 1225 | _variant_t fndx((long)0); |
1226 | CString szName; | 1226 | CString szName; |
1227 | long iType; | 1227 | long iType; |
1228 | OLEListViewItem* hChild; | 1228 | OLEListViewItem* hChild; |
@@ -1242,129 +1242,129 @@ void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent | |||
1242 | QString ts; | 1242 | QString ts; |
1243 | switch( iType ) { | 1243 | switch( iType ) { |
1244 | case 0: | 1244 | case 0: |
1245 | ts = i18n("Mail"); | 1245 | ts = i18n("Mail"); |
1246 | break; | 1246 | break; |
1247 | case 1: | 1247 | case 1: |
1248 | ts = i18n("Calendar"); | 1248 | ts = i18n("Calendar"); |
1249 | break; | 1249 | break; |
1250 | case 2: | 1250 | case 2: |
1251 | ts = i18n("Contacts"); | 1251 | ts = i18n("Contacts"); |
1252 | break; | 1252 | break; |
1253 | case 3: | 1253 | case 3: |
1254 | ts = i18n("Todos"); | 1254 | ts = i18n("Todos"); |
1255 | break; | 1255 | break; |
1256 | case 4: | 1256 | case 4: |
1257 | ts = i18n("Journals"); | 1257 | ts = i18n("Journals"); |
1258 | break; | 1258 | break; |
1259 | case 5: | 1259 | case 5: |
1260 | ts = i18n("Notes"); | 1260 | ts = i18n("Notes"); |
1261 | break; | 1261 | break; |
1262 | default: | 1262 | default: |
1263 | ts = i18n("Unknown"); | 1263 | ts = i18n("Unknown"); |
1264 | } | 1264 | } |
1265 | hChild->setText( 1,ts); | 1265 | hChild->setText( 1,ts); |
1266 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); | 1266 | hChild->setData( (DWORD) mfChild.m_lpDispatch ); |
1267 | mfChild.m_lpDispatch->AddRef(); | 1267 | mfChild.m_lpDispatch->AddRef(); |
1268 | addFolder(hChild, mfChild.m_lpDispatch); | 1268 | addFolder(hChild, mfChild.m_lpDispatch); |
1269 | } | 1269 | } |
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | void KAImportOLdialog::slotApply() | 1272 | void KAImportOLdialog::slotApply() |
1273 | { | 1273 | { |
1274 | importedItems = 0; | 1274 | importedItems = 0; |
1275 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); | 1275 | OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); |
1276 | while ( child ) { | 1276 | while ( child ) { |
1277 | if ( child->isOn() ) { | 1277 | if ( child->isOn() ) { |
1278 | readContactData( child->data() ); | 1278 | readContactData( child->data() ); |
1279 | if ( mSyncMode ) { | 1279 | if ( mSyncMode ) { |
1280 | mSelectedFolderID = child->dataID(); | 1280 | mSelectedFolderID = child->dataID(); |
1281 | accept(); | 1281 | accept(); |
1282 | return; | 1282 | return; |
1283 | } | 1283 | } |
1284 | } | 1284 | } |
1285 | child = (OLEListViewItem*) child->itemBelow(); | 1285 | child = (OLEListViewItem*) child->itemBelow(); |
1286 | } | 1286 | } |
1287 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); | 1287 | QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); |
1288 | KMessageBox::information(this,mes); | 1288 | KMessageBox::information(this,mes); |
1289 | } | 1289 | } |
1290 | void KAImportOLdialog::readContactData( DWORD folder ) | 1290 | void KAImportOLdialog::readContactData( DWORD folder ) |
1291 | { | 1291 | { |
1292 | 1292 | ||
1293 | LPDISPATCH dispItem = (LPDISPATCH)folder; | 1293 | LPDISPATCH dispItem = (LPDISPATCH)folder; |
1294 | dispItem->AddRef(); | 1294 | dispItem->AddRef(); |
1295 | MAPIFolder mf(dispItem); | 1295 | MAPIFolder mf(dispItem); |
1296 | mf.m_lpDispatch->AddRef(); | 1296 | mf.m_lpDispatch->AddRef(); |
1297 | _Items folderItems; | 1297 | _Items folderItems; |
1298 | _variant_t indx((long)0); | 1298 | _variant_t indx((long)0); |
1299 | LPDISPATCH itm; | 1299 | LPDISPATCH itm; |
1300 | int i; | 1300 | int i; |
1301 | folderItems = mf.GetItems(); | 1301 | folderItems = mf.GetItems(); |
1302 | QString cap = i18n("Importing contact data"); | 1302 | QString cap = i18n("Importing contact data"); |
1303 | if ( mSyncMode ) { | 1303 | if ( mSyncMode ) { |
1304 | cap = i18n("Reading contact data..."); | 1304 | cap = i18n("Reading contact data..."); |
1305 | } | 1305 | } |
1306 | QProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(),this); | 1306 | Q3ProgressDialog bar( cap,i18n("Abort"), folderItems.GetCount(),this); |
1307 | bar.setCaption (i18n("Accessing OL") ); | 1307 | bar.setCaption (i18n("Accessing OL") ); |
1308 | int h = bar.sizeHint().height() ; | 1308 | int h = bar.sizeHint().height() ; |
1309 | int w = 300; | 1309 | int w = 300; |
1310 | int dw = QApplication::desktop()->width(); | 1310 | int dw = QApplication::desktop()->width(); |
1311 | int dh = QApplication::desktop()->height(); | 1311 | int dh = QApplication::desktop()->height(); |
1312 | //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1312 | //bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1313 | bar.show(); | 1313 | bar.show(); |
1314 | for(i=1; i <= folderItems.GetCount(); ++i) | 1314 | for(i=1; i <= folderItems.GetCount(); ++i) |
1315 | { | 1315 | { |
1316 | qApp->processEvents(); | 1316 | qApp->processEvents(); |
1317 | if ( ! bar.isVisible() ) | 1317 | if ( ! bar.isVisible() ) |
1318 | return ; | 1318 | return ; |
1319 | bar.setProgress( i ); | 1319 | bar.setProgress( i ); |
1320 | indx = (long)i; | 1320 | indx = (long)i; |
1321 | itm = folderItems.Item(indx.Detach()); | 1321 | itm = folderItems.Item(indx.Detach()); |
1322 | _ContactItem * pItem = (_ContactItem *)&itm; | 1322 | _ContactItem * pItem = (_ContactItem *)&itm; |
1323 | if ( addAddressee( ol2kapiContact( pItem, mSyncMode ) )) | 1323 | if ( addAddressee( ol2kapiContact( pItem, mSyncMode ) )) |
1324 | ++importedItems; | 1324 | ++importedItems; |
1325 | itm->Release(); | 1325 | itm->Release(); |
1326 | } | 1326 | } |
1327 | } | 1327 | } |
1328 | void KAImportOLdialog::slotOk() | 1328 | void KAImportOLdialog::slotOk() |
1329 | { | 1329 | { |
1330 | QDialog::accept(); | 1330 | QDialog::accept(); |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | KABC::Addressee KAImportOLdialog::ol2kapiContact( _ContactItem * aItem , bool syncMode) | 1333 | KABC::Addressee KAImportOLdialog::ol2kapiContact( _ContactItem * aItem , bool syncMode) |
1334 | { | 1334 | { |
1335 | KABC::Addressee addressee; | 1335 | KABC::Addressee addressee; |
1336 | 1336 | ||
1337 | addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); | 1337 | addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); |
1338 | //GetLastModificationTime() | 1338 | //GetLastModificationTime() |
1339 | //addressee.setName( const QString &name ); | 1339 | //addressee.setName( const QString &name ); |
1340 | addressee.setFormattedName( QString::fromUcs2(aItem->GetFileAs().GetBuffer()) ); | 1340 | addressee.setFormattedName( QString::fromUcs2(aItem->GetFileAs().GetBuffer()) ); |
1341 | addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); | 1341 | addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); |
1342 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); | 1342 | addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); |
1343 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); | 1343 | addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); |
1344 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); | 1344 | addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); |
1345 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); | 1345 | addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); |
1346 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); | 1346 | addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); |
1347 | QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); | 1347 | QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); |
1348 | if ( dtb.isValid() ) | 1348 | if ( dtb.isValid() ) |
1349 | addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); | 1349 | addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); |
1350 | 1350 | ||
1351 | //QString::fromUcs2(aItem->.GetBuffer()) | 1351 | //QString::fromUcs2(aItem->.GetBuffer()) |
1352 | //addressee.setMailer( const QString &mailer ); | 1352 | //addressee.setMailer( const QString &mailer ); |
1353 | //addressee.setTimeZone( const TimeZone &timeZone ); | 1353 | //addressee.setTimeZone( const TimeZone &timeZone ); |
1354 | //addressee.setGeo( const Geo &geo ); | 1354 | //addressee.setGeo( const Geo &geo ); |
1355 | //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix | 1355 | //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix |
1356 | addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); | 1356 | addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); |
1357 | addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); | 1357 | addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") ); |
1358 | QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); | 1358 | QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); |
1359 | notesStr.replace( QRegExp("\\r"), ""); | 1359 | notesStr.replace( QRegExp("\\r"), ""); |
1360 | 1360 | ||
1361 | addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); | 1361 | addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); |
1362 | //addressee.setRevision( const QDateTime &revision ); | 1362 | //addressee.setRevision( const QDateTime &revision ); |
1363 | // addressee.setSortString( const QString &sortString ); | 1363 | // addressee.setSortString( const QString &sortString ); |
1364 | addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); | 1364 | addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); |
1365 | 1365 | ||
1366 | QString tempS; | 1366 | QString tempS; |
1367 | tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer());//+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); | 1367 | tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer());//+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); |
1368 | if ( tempS.length() > 12 ) | 1368 | if ( tempS.length() > 12 ) |
1369 | addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); | 1369 | addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); |
1370 | tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); | 1370 | tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); |
diff --git a/libkdepim/ol_access.h b/libkdepim/ol_access.h index 85dbc6c..3422f65 100755 --- a/libkdepim/ol_access.h +++ b/libkdepim/ol_access.h | |||
@@ -1,174 +1,174 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE/Pim-Pi | 2 | This file is part of KDE/Pim-Pi |
3 | Copyright (c) 2006 Lutz Rogowski | 3 | Copyright (c) 2006 Lutz Rogowski |
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 OL_ACCESS_H | 23 | #ifndef OL_ACCESS_H |
24 | #define OL_ACCESS_H | 24 | #define OL_ACCESS_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | 27 | ||
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
29 | #include <kabc/addressee.h> | 29 | #include <kabc/addressee.h> |
30 | #include <kabc/addressbook.h> | 30 | #include <kabc/addressbook.h> |
31 | 31 | ||
32 | #include <afxdisp.h> | 32 | #include <afxdisp.h> |
33 | 33 | ||
34 | #include "../outport/msoutl9.h" | 34 | #include "../outport/msoutl9.h" |
35 | 35 | ||
36 | #define OL_CONTACT_DATA 2 | 36 | #define OL_CONTACT_DATA 2 |
37 | #define OL_CALENDAR_DATA 1 //pending is this the right number | 37 | #define OL_CALENDAR_DATA 1 //pending is this the right number |
38 | 38 | ||
39 | class QDateTime; | 39 | class QDateTime; |
40 | class QListView; | 40 | class Q3ListView; |
41 | class OLEListViewItem; | 41 | class OLEListViewItem; |
42 | class _ContactItem; | 42 | class _ContactItem; |
43 | class OL_access : public QObject | 43 | class OL_access : public QObject |
44 | { | 44 | { |
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | public: | 46 | public: |
47 | static OL_access *instance(); | 47 | static OL_access *instance(); |
48 | ~OL_access(); | 48 | ~OL_access(); |
49 | //static converter methods | 49 | //static converter methods |
50 | static QDateTime mDdate2Qdtr( DATE dt); | 50 | static QDateTime mDdate2Qdtr( DATE dt); |
51 | static DATE Qdt2date( QDateTime dt ); | 51 | static DATE Qdt2date( QDateTime dt ); |
52 | static KABC::Addressee ol2kapiContact( _ContactItem * aItem , bool syncMode); | 52 | static KABC::Addressee ol2kapiContact( _ContactItem * aItem , bool syncMode); |
53 | static void writeData2OLitem( KABC::Addressee addressee, _ContactItem * aItem ); | 53 | static void writeData2OLitem( KABC::Addressee addressee, _ContactItem * aItem ); |
54 | 54 | ||
55 | KABC::Addressee::List importOLcontacts(); | 55 | KABC::Addressee::List importOLcontacts(); |
56 | QStringList getFolderSelection( int type, QString caption ); | 56 | QStringList getFolderSelection( int type, QString caption ); |
57 | void readContactData( LPDISPATCH folder, KABC::Addressee::List* list, bool syncMode ); | 57 | void readContactData( LPDISPATCH folder, KABC::Addressee::List* list, bool syncMode ); |
58 | 58 | ||
59 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder, QString selectedFolderID ); | 59 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder, QString selectedFolderID ); |
60 | bool setSelectedFolder( QString folderID ); | 60 | bool setSelectedFolder( QString folderID ); |
61 | //call setSelectedFolder() before using the next methods: | 61 | //call setSelectedFolder() before using the next methods: |
62 | void deleteAddressee( KABC::Addressee a ); | 62 | void deleteAddressee( KABC::Addressee a ); |
63 | KABC::Addressee changeAddressee( KABC::Addressee a ); | 63 | KABC::Addressee changeAddressee( KABC::Addressee a ); |
64 | KABC::Addressee addAddressee( KABC::Addressee a ); | 64 | KABC::Addressee addAddressee( KABC::Addressee a ); |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | public slots: | 69 | public slots: |
70 | 70 | ||
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | 73 | ||
74 | protected slots: | 74 | protected slots: |
75 | 75 | ||
76 | 76 | ||
77 | protected: | 77 | protected: |
78 | 78 | ||
79 | private: | 79 | private: |
80 | _Application gOlAppAB; | 80 | _Application gOlAppAB; |
81 | bool mErrorInit; | 81 | bool mErrorInit; |
82 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent, long fType); | 82 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent, long fType); |
83 | LPDISPATCH getOLcontactItemFromUid( QString uid ); | 83 | LPDISPATCH getOLcontactItemFromUid( QString uid ); |
84 | 84 | ||
85 | QString mSelectedFolderID; | 85 | QString mSelectedFolderID; |
86 | LPDISPATCH mSelectedFolder; | 86 | LPDISPATCH mSelectedFolder; |
87 | _Items mFolderItems; | 87 | _Items mFolderItems; |
88 | 88 | ||
89 | OL_access(); | 89 | OL_access(); |
90 | static OL_access *sInstance; | 90 | static OL_access *sInstance; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | 93 | ||
94 | #if 0 | 94 | #if 0 |
95 | //using namespace KABC; | 95 | //using namespace KABC; |
96 | //class KABC::AddressBook; | 96 | //class KABC::AddressBook; |
97 | 97 | ||
98 | /** | 98 | /** |
99 | This is the base class for the calendar component editors. | 99 | This is the base class for the calendar component editors. |
100 | */ | 100 | */ |
101 | class KAImportOLdialog : public KDialogBase | 101 | class KAImportOLdialog : public KDialogBase |
102 | { | 102 | { |
103 | Q__OBJECT | 103 | Q__OBJECT |
104 | public: | 104 | public: |
105 | /** | 105 | /** |
106 | Construct new IncidenceEditor. | 106 | Construct new IncidenceEditor. |
107 | */ | 107 | */ |
108 | KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook, | 108 | KAImportOLdialog( const QString &caption, KABC::AddressBook * aBook, |
109 | QWidget *parent ); | 109 | QWidget *parent ); |
110 | ~KAImportOLdialog(); | 110 | ~KAImportOLdialog(); |
111 | 111 | ||
112 | /** Initialize editor. This function creates the tab widgets. */ | 112 | /** Initialize editor. This function creates the tab widgets. */ |
113 | void init(); | 113 | void init(); |
114 | void setSyncMode(); | 114 | void setSyncMode(); |
115 | KABC::Addressee::List getAddressList(); | 115 | KABC::Addressee::List getAddressList(); |
116 | QString selectedFolderID() {return mSelectedFolderID;} | 116 | QString selectedFolderID() {return mSelectedFolderID;} |
117 | static KABC::Addressee ol2kapiContact( _ContactItem * , bool syncMode ); | 117 | static KABC::Addressee ol2kapiContact( _ContactItem * , bool syncMode ); |
118 | static bool sOLDispatch; | 118 | static bool sOLDispatch; |
119 | pub_lic sl_ots: | 119 | pub_lic sl_ots: |
120 | 120 | ||
121 | 121 | ||
122 | sign_als: | 122 | sign_als: |
123 | 123 | ||
124 | prote_cted slo_ts: | 124 | prote_cted slo_ts: |
125 | void slotApply(); | 125 | void slotApply(); |
126 | void slotOk(); | 126 | void slotOk(); |
127 | void slotCancel(); | 127 | void slotCancel(); |
128 | 128 | ||
129 | protected: | 129 | protected: |
130 | void setupFolderView(); | 130 | void setupFolderView(); |
131 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); | 131 | void addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent); |
132 | void readContactData( DWORD folder ); | 132 | void readContactData( DWORD folder ); |
133 | 133 | ||
134 | KABC::AddressBook * mABook; | 134 | KABC::AddressBook * mABook; |
135 | QListView * mListView; | 135 | Q3ListView * mListView; |
136 | KABC::Addressee::List mAList; | 136 | KABC::Addressee::List mAList; |
137 | bool addAddressee( KABC::Addressee a ); | 137 | bool addAddressee( KABC::Addressee a ); |
138 | private: | 138 | private: |
139 | int importedItems; | 139 | int importedItems; |
140 | bool mSyncMode; | 140 | bool mSyncMode; |
141 | QString mSelectedFolderID; | 141 | QString mSelectedFolderID; |
142 | }; | 142 | }; |
143 | class KAwritebackOL : public QObject | 143 | class KAwritebackOL : public QObject |
144 | { | 144 | { |
145 | Q__OBJECT | 145 | Q__OBJECT |
146 | public: | 146 | public: |
147 | KAwritebackOL( const QString &olFolderID ); | 147 | KAwritebackOL( const QString &olFolderID ); |
148 | ~KAwritebackOL(); | 148 | ~KAwritebackOL(); |
149 | bool init(); | 149 | bool init(); |
150 | void deleteAddressee( KABC::Addressee a ); | 150 | void deleteAddressee( KABC::Addressee a ); |
151 | KABC::Addressee changeAddressee( KABC::Addressee a ); | 151 | KABC::Addressee changeAddressee( KABC::Addressee a ); |
152 | KABC::Addressee addAddressee( KABC::Addressee a ); | 152 | KABC::Addressee addAddressee( KABC::Addressee a ); |
153 | public sl_ots: | 153 | public sl_ots: |
154 | 154 | ||
155 | 155 | ||
156 | signals: | 156 | signals: |
157 | 157 | ||
158 | protected sl_ots: | 158 | protected sl_ots: |
159 | 159 | ||
160 | 160 | ||
161 | protected: | 161 | protected: |
162 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder ); | 162 | LPDISPATCH getFolderFromID( LPDISPATCH parentFolder ); |
163 | LPDISPATCH getOLitemFromUid( QString uid ); | 163 | LPDISPATCH getOLitemFromUid( QString uid ); |
164 | void writeData2OLitem( KABC::Addressee a, _ContactItem * olitem ); | 164 | void writeData2OLitem( KABC::Addressee a, _ContactItem * olitem ); |
165 | private: | 165 | private: |
166 | QString mSelectedFolderID; | 166 | QString mSelectedFolderID; |
167 | LPDISPATCH mSelectedFolder; | 167 | LPDISPATCH mSelectedFolder; |
168 | _Items mFolderItems; | 168 | _Items mFolderItems; |
169 | }; | 169 | }; |
170 | 170 | ||
171 | #endif | 171 | #endif |
172 | #endif | 172 | #endif |
173 | 173 | ||
174 | 174 | ||
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index 89db22b..0ea73f5 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp | |||
@@ -1,187 +1,190 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qptrlist.h> | 25 | #include <QDesktopWidget> |
26 | #include <q3ptrlist.h> | ||
26 | #include <qregexp.h> | 27 | #include <qregexp.h> |
27 | #include <qfile.h> | 28 | #include <qfile.h> |
28 | #include <qlabel.h> | 29 | #include <qlabel.h> |
29 | #include <qtextstream.h> | 30 | #include <q3textstream.h> |
30 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
31 | #include <qdir.h> | 32 | #include <qdir.h> |
32 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
33 | #include <stdlib.h> | 34 | #include <stdlib.h> |
34 | #include "phoneaccess.h" | 35 | #include "phoneaccess.h" |
35 | 36 | ||
36 | void PhoneAccess::writeConfig( QString device, QString connection, QString model ) | 37 | void PhoneAccess::writeConfig( QString device, QString connection, QString model ) |
37 | { | 38 | { |
38 | #ifdef _WIN32_ | 39 | #ifdef _WIN32_ |
39 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; | 40 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; |
40 | #else | 41 | #else |
41 | QString fileName = QDir::homeDirPath() +"/.gammurc"; | 42 | QString fileName = QDir::homeDirPath() +"/.gammurc"; |
42 | #endif | 43 | #endif |
43 | //qDebug("save %d ", load ); | 44 | //qDebug("save %d ", load ); |
44 | QString content = "[gammu]\n";; | 45 | QString content = "[gammu]\n";; |
45 | bool write = false; | 46 | bool write = false; |
46 | bool addPort = true, addConnection = true, addModel = true; | 47 | bool addPort = true, addConnection = true, addModel = true; |
47 | QFile file( fileName ); | 48 | QFile file( fileName ); |
48 | if ( QFile::exists( fileName) ) { | 49 | if ( QFile::exists( fileName) ) { |
49 | if (!file.open( IO_ReadOnly ) ) { | 50 | if (!file.open( QIODevice::ReadOnly ) ) { |
50 | qDebug("Error: cannot open %s ", fileName.latin1() ); | 51 | qDebug("Error: cannot open %s ", fileName.latin1() ); |
51 | return; | 52 | return; |
52 | } | 53 | } |
53 | QString line; | 54 | QString line; |
54 | while ( file.readLine( line, 1024 ) > 0 ) { | 55 | char tmp[1024]; |
56 | while ( file.readLine( tmp, 1024 ) > 0 ) { | ||
57 | line = tmp; | ||
55 | //qDebug("*%s* ", line.latin1() ); | 58 | //qDebug("*%s* ", line.latin1() ); |
56 | if ( line.left(7 ) == "[gammu]" ) { | 59 | if ( line.left(7 ) == "[gammu]" ) { |
57 | ; | 60 | ; |
58 | } else | 61 | } else |
59 | if ( line.left(4 ) == "port" ) { | 62 | if ( line.left(4 ) == "port" ) { |
60 | if ( line == "port = " + device+"\n" ) { | 63 | if ( line == "port = " + device+"\n" ) { |
61 | content += line ; | 64 | content += line ; |
62 | addPort = false; | 65 | addPort = false; |
63 | //qDebug("port found" ); | 66 | //qDebug("port found" ); |
64 | } | 67 | } |
65 | 68 | ||
66 | } else if ( line.left(5 ) == "model" ) { | 69 | } else if ( line.left(5 ) == "model" ) { |
67 | if ( line == "model = " + model +"\n") { | 70 | if ( line == "model = " + model +"\n") { |
68 | content += line ; | 71 | content += line ; |
69 | addModel = false; | 72 | addModel = false; |
70 | //qDebug("model found" ); | 73 | //qDebug("model found" ); |
71 | } | 74 | } |
72 | 75 | ||
73 | } else if ( line.left( 10 ) == "connection" ) { | 76 | } else if ( line.left( 10 ) == "connection" ) { |
74 | if ( line == "connection = " + connection +"\n") { | 77 | if ( line == "connection = " + connection +"\n") { |
75 | addConnection = false; | 78 | addConnection = false; |
76 | content += line ; | 79 | content += line ; |
77 | //qDebug("con found" ); | 80 | //qDebug("con found" ); |
78 | } | 81 | } |
79 | 82 | ||
80 | } else { | 83 | } else { |
81 | content += line ; | 84 | content += line ; |
82 | } | 85 | } |
83 | } | 86 | } |
84 | file.close(); | 87 | file.close(); |
85 | } else { | 88 | } else { |
86 | if ( ! connection.isEmpty() ) { | 89 | if ( ! connection.isEmpty() ) { |
87 | addConnection = true; | 90 | addConnection = true; |
88 | } | 91 | } |
89 | if ( ! device.isEmpty() ) { | 92 | if ( ! device.isEmpty() ) { |
90 | addPort = true; | 93 | addPort = true; |
91 | 94 | ||
92 | } | 95 | } |
93 | if ( ! model.isEmpty() ) { | 96 | if ( ! model.isEmpty() ) { |
94 | addModel = true; | 97 | addModel = true; |
95 | } | 98 | } |
96 | } | 99 | } |
97 | 100 | ||
98 | if ( addConnection ) { | 101 | if ( addConnection ) { |
99 | write = true; | 102 | write = true; |
100 | content += "connection = "; | 103 | content += "connection = "; |
101 | content += connection; | 104 | content += connection; |
102 | content += "\n"; | 105 | content += "\n"; |
103 | } | 106 | } |
104 | if ( addPort ) { | 107 | if ( addPort ) { |
105 | write = true; | 108 | write = true; |
106 | content += "port = "; | 109 | content += "port = "; |
107 | content += device; | 110 | content += device; |
108 | content += "\n"; | 111 | content += "\n"; |
109 | 112 | ||
110 | } | 113 | } |
111 | if ( addModel ) { | 114 | if ( addModel ) { |
112 | write = true; | 115 | write = true; |
113 | content += "model = "; | 116 | content += "model = "; |
114 | content += model; | 117 | content += model; |
115 | content += "\n"; | 118 | content += "\n"; |
116 | } | 119 | } |
117 | if ( write ) { | 120 | if ( write ) { |
118 | if (!file.open( IO_WriteOnly ) ) { | 121 | if (!file.open( QIODevice::WriteOnly ) ) { |
119 | qDebug("Error: cannot write file %s ", fileName.latin1() ); | 122 | qDebug("Error: cannot write file %s ", fileName.latin1() ); |
120 | return; | 123 | return; |
121 | } | 124 | } |
122 | qDebug("Writing file %s ", fileName.latin1() ); | 125 | qDebug("Writing file %s ", fileName.latin1() ); |
123 | QTextStream ts( &file ); | 126 | Q3TextStream ts( &file ); |
124 | ts << content ; | 127 | ts << content ; |
125 | file.close(); | 128 | file.close(); |
126 | } | 129 | } |
127 | 130 | ||
128 | } | 131 | } |
129 | 132 | ||
130 | 133 | ||
131 | bool PhoneAccess::writeToPhone( QString fileName) | 134 | bool PhoneAccess::writeToPhone( QString fileName) |
132 | { | 135 | { |
133 | 136 | ||
134 | #ifdef DESKTOP_VERSION | 137 | #ifdef DESKTOP_VERSION |
135 | #ifdef _WIN32_ | 138 | #ifdef _WIN32_ |
136 | QString command ="kammu --restore " + fileName ; | 139 | QString command ="kammu --restore " + fileName ; |
137 | #else | 140 | #else |
138 | QString command ="./kammu --restore " + fileName ; | 141 | QString command ="./kammu --restore " + fileName ; |
139 | #endif | 142 | #endif |
140 | #else | 143 | #else |
141 | QString command ="kammu --restore " + fileName ; | 144 | QString command ="kammu --restore " + fileName ; |
142 | #endif | 145 | #endif |
143 | int ret = 1; | 146 | int ret = 1; |
144 | while ( ret != 0 ) { | 147 | while ( ret != 0 ) { |
145 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); | 148 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); |
146 | int w = 235; | 149 | int w = 235; |
147 | int h = status->sizeHint().height()+20 ; | 150 | int h = status->sizeHint().height()+20 ; |
148 | int dw = QApplication::desktop()->width(); | 151 | int dw = QApplication::desktop()->width(); |
149 | int dh = QApplication::desktop()->height(); | 152 | int dh = QApplication::desktop()->height(); |
150 | if ( dw > 310 ) | 153 | if ( dw > 310 ) |
151 | w = 310; | 154 | w = 310; |
152 | status->setCaption(i18n("Writing to phone...") ); | 155 | status->setCaption(i18n("Writing to phone...") ); |
153 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 156 | status->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
154 | status->show(); | 157 | status->show(); |
155 | status->raise(); | 158 | status->raise(); |
156 | status->update(); | 159 | status->update(); |
157 | qApp->processEvents(); | 160 | qApp->processEvents(); |
158 | status->update(); | 161 | status->update(); |
159 | qApp->processEvents(); | 162 | qApp->processEvents(); |
160 | ret = system ( command.latin1()); | 163 | ret = system ( command.latin1()); |
161 | delete status; | 164 | delete status; |
162 | qApp->processEvents(); | 165 | qApp->processEvents(); |
163 | if ( ret ) { | 166 | if ( ret ) { |
164 | qDebug("Error S::command returned %d.", ret); | 167 | qDebug("Error S::command returned %d.", ret); |
165 | int retval = KMessageBox::warningContinueCancel(0, | 168 | int retval = KMessageBox::warningContinueCancel(0, |
166 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); | 169 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KDE/Pim phone access"),i18n("Retry"),i18n("Cancel")); |
167 | if ( retval != KMessageBox::Continue ) | 170 | if ( retval != KMessageBox::Continue ) |
168 | return false; | 171 | return false; |
169 | } | 172 | } |
170 | } | 173 | } |
171 | return true; | 174 | return true; |
172 | } | 175 | } |
173 | bool PhoneAccess::readFromPhone( QString fileName) | 176 | bool PhoneAccess::readFromPhone( QString fileName) |
174 | { | 177 | { |
175 | 178 | ||
176 | #ifdef DESKTOP_VERSION | 179 | #ifdef DESKTOP_VERSION |
177 | #ifdef _WIN32_ | 180 | #ifdef _WIN32_ |
178 | QString command ="kammu --backup " + fileName + " -yes" ; | 181 | QString command ="kammu --backup " + fileName + " -yes" ; |
179 | #else | 182 | #else |
180 | QString command ="./kammu --backup " + fileName + " -yes" ; | 183 | QString command ="./kammu --backup " + fileName + " -yes" ; |
181 | #endif | 184 | #endif |
182 | #else | 185 | #else |
183 | QString command ="kammu --backup " + fileName + " -yes" ; | 186 | QString command ="kammu --backup " + fileName + " -yes" ; |
184 | #endif | 187 | #endif |
185 | int ret = 1; | 188 | int ret = 1; |
186 | while ( ret != 0 ) { | 189 | while ( ret != 0 ) { |
187 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); | 190 | QLabel* status = new QLabel( i18n(" This may take 1-3 minutes!"), 0 ); |