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-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.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 | |||
@@ -10,92 +10,93 @@ | |||
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() |
@@ -108,34 +109,34 @@ void CategoryEditDialog::modify() | |||
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 | |||
@@ -11,76 +11,76 @@ | |||
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,84 +1,88 @@ | |||
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() ); |
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 | |||
@@ -8,50 +8,53 @@ | |||
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() ) ); |
@@ -68,179 +71,179 @@ void CategorySelectDialog::editCategoriesDialog() | |||
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 | |||
@@ -13,63 +13,63 @@ | |||
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,68 +1,71 @@ | |||
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 ); |
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 | |||
@@ -26,33 +26,35 @@ 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 | ********************************************************************************/ |
@@ -110,56 +112,56 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa | |||
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 | { |
@@ -213,39 +215,39 @@ bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QSt | |||
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 | } |
@@ -292,42 +294,42 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString | |||
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 | ||
@@ -505,35 +507,35 @@ ExternalAppHandler *ExternalAppHandler::instance() | |||
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 | ||
@@ -733,59 +735,59 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
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; |
@@ -818,52 +820,52 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e | |||
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 | ||
@@ -1219,33 +1221,33 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete | |||
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; |
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index b899ad7..3247fe4 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -21,103 +21,106 @@ | |||
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) |
@@ -212,70 +215,70 @@ class ExternalAppHandler : public QObject | |||
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 | ||
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 | |||
@@ -17,57 +17,59 @@ | |||
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(); |
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 | |||
@@ -18,42 +18,47 @@ | |||
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> |
@@ -88,132 +93,132 @@ $Id$ | |||
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 | ||
@@ -257,49 +262,49 @@ void KDEPIMConfigWidget::saveStoreSettings() | |||
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 ); |
@@ -339,33 +344,33 @@ void KDEPIMConfigWidget::setupExternalAppTab() | |||
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)"; |
@@ -407,96 +412,96 @@ void KDEPIMConfigWidget::setupLocaleDateTab() | |||
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++) |
@@ -537,33 +542,33 @@ void KDEPIMConfigWidget::setupTimeZoneTab() | |||
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 ) |
@@ -698,33 +703,33 @@ void KDEPIMConfigWidget::saveEditFieldSettings() | |||
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); |
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 | |||
@@ -21,40 +21,42 @@ | |||
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. */ |
@@ -93,33 +95,33 @@ class KDEPIMConfigWidget : public KPrefsWidget | |||
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; |
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index bf38479..28c88d4 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -14,92 +14,96 @@ | |||
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 |
@@ -212,61 +216,61 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm | |||
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; |
@@ -331,65 +335,65 @@ QDate KDateEdit::date() const | |||
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 { |
diff --git a/libkdepim/kdateedit.h b/libkdepim/kdateedit.h index 2d8c452..38eacde 100644 --- a/libkdepim/kdateedit.h +++ b/libkdepim/kdateedit.h | |||
@@ -11,58 +11,61 @@ | |||
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; |
@@ -115,29 +118,29 @@ class KDateEdit : public QHBox | |||
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 | |||
@@ -10,50 +10,54 @@ | |||
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; |
diff --git a/libkdepim/kdatepicker.h b/libkdepim/kdatepicker.h index 3db9a89..4d904da 100644 --- a/libkdepim/kdatepicker.h +++ b/libkdepim/kdatepicker.h | |||
@@ -7,61 +7,64 @@ | |||
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 |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 9c28425..3677e87 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -25,33 +25,33 @@ | |||
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); |
@@ -129,49 +129,49 @@ void KPimGlobalPrefs::setGlobalConfig() | |||
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 ); |
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h index 94ac8ae..01f5ab0 100644 --- a/libkdepim/kpimglobalprefs.h +++ b/libkdepim/kpimglobalprefs.h | |||
@@ -19,33 +19,33 @@ | |||
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, |
@@ -72,33 +72,33 @@ class KPimGlobalPrefs : public KPrefs | |||
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; |
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index 6dc741d..358acbd 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -12,49 +12,50 @@ | |||
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" |
@@ -115,33 +116,33 @@ QLabel *KPrefsDialogWidColor::label() | |||
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 | ||
@@ -199,45 +200,45 @@ void KPrefsDialogWidTime::writeConfig() | |||
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, |
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index 52ec809..cc95dd4 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -11,45 +11,47 @@ | |||
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 | */ |
@@ -245,41 +247,41 @@ class KPrefsDialogWidRadios : public KPrefsDialogWid | |||
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. |
@@ -426,33 +428,33 @@ class KPrefsDialog : public KDialogBase | |||
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 | ||
diff --git a/libkdepim/kprefswidget.cpp b/libkdepim/kprefswidget.cpp index f6a0b38..51431e2 100644 --- a/libkdepim/kprefswidget.cpp +++ b/libkdepim/kprefswidget.cpp | |||
@@ -12,49 +12,50 @@ | |||
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, |
@@ -118,33 +119,33 @@ QLabel *KPrefsWidColor::label() | |||
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 | ||
@@ -205,46 +206,46 @@ void KPrefsWidTime::writeConfig() | |||
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, |
diff --git a/libkdepim/kprefswidget.h b/libkdepim/kprefswidget.h index 8543a39..9de1be5 100644 --- a/libkdepim/kprefswidget.h +++ b/libkdepim/kprefswidget.h | |||
@@ -12,45 +12,47 @@ | |||
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. |
@@ -252,41 +254,41 @@ class KPrefsWidRadios : public KPrefsWid | |||
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. |
@@ -436,20 +438,20 @@ class KPrefsWidget : public QWidget | |||
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 | |||
@@ -22,87 +22,90 @@ | |||
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"); |
@@ -342,33 +345,33 @@ void KSyncManager::slotSyncMenu( int action ) | |||
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 ); |
@@ -791,33 +794,33 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
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 ); |
@@ -825,34 +828,34 @@ bool KSyncManager::edit_pisync_options() | |||
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); |
@@ -878,33 +881,33 @@ bool KSyncManager::edit_sync_options() | |||
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 | ||
@@ -1321,71 +1324,71 @@ void KSyncManager::readFileFromSocket() | |||
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 | } |
@@ -1449,55 +1452,55 @@ void KServerSocket::readClient() | |||
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 ) |
@@ -1523,103 +1526,103 @@ void KServerSocket::send_file() | |||
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"; |
@@ -1635,43 +1638,43 @@ KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port | |||
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() |
@@ -1683,100 +1686,100 @@ void KCommandSocket::updateConnectDialog() | |||
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() |
@@ -1816,51 +1819,51 @@ void KCommandSocket::readFileFromSocket() | |||
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(); |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 71d17e9..32c6557 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -11,83 +11,85 @@ | |||
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 | ||
@@ -95,57 +97,57 @@ class KCommandSocket : public QObject | |||
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(); |
@@ -206,34 +208,34 @@ class KSyncManager : public QObject | |||
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*/) |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 2b87298..fd5bbca 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -10,54 +10,58 @@ | |||
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> |
@@ -76,322 +80,322 @@ KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : | |||
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"); |
@@ -455,33 +459,33 @@ void KSyncPrefsDialog::readFilter() | |||
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 ); |
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h index d8c02de..1d7503e 100644 --- a/libkdepim/ksyncprefsdialog.h +++ b/libkdepim/ksyncprefsdialog.h | |||
@@ -12,48 +12,48 @@ | |||
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 | ||
@@ -73,56 +73,56 @@ class KSyncPrefsDialog : public KDialog | |||
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; |
@@ -139,33 +139,33 @@ class KSyncPrefsDialog : public KDialog | |||
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 | |||
@@ -7,33 +7,33 @@ | |||
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(); |
diff --git a/libkdepim/libkdepim.pro b/libkdepim/libkdepim.pro index 7160d0e..fb27311 100644 --- a/libkdepim/libkdepim.pro +++ b/libkdepim/libkdepim.pro | |||
@@ -1,20 +1,20 @@ | |||
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 | ||
@@ -61,16 +61,18 @@ SOURCES = \ | |||
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,22 +1,22 @@ | |||
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 \ |
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 | |||
@@ -9,97 +9,97 @@ | |||
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 | { |
@@ -136,57 +136,57 @@ KABC::Addressee::List OL_access::importOLcontacts() | |||
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 ); |
@@ -1122,59 +1122,59 @@ QDateTime mDdate2Qdtr( DATE dt) | |||
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; |
@@ -1290,33 +1290,33 @@ void KAImportOLdialog::slotApply() | |||
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; |
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 | |||
@@ -24,33 +24,33 @@ | |||
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 ); |
@@ -119,33 +119,33 @@ class KAImportOLdialog : public KDialogBase | |||
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 ); |
diff --git a/libkdepim/phoneaccess.cpp b/libkdepim/phoneaccess.cpp index 89db22b..0ea73f5 100644 --- a/libkdepim/phoneaccess.cpp +++ b/libkdepim/phoneaccess.cpp | |||
@@ -9,62 +9,65 @@ | |||
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" ); |
@@ -102,38 +105,38 @@ void PhoneAccess::writeConfig( QString device, QString connection, QString model | |||
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 |