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 /microkde/kutils/kcmultidialog.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kutils/kcmultidialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp index 9c87682..88f17e5 100644 --- a/microkde/kutils/kcmultidialog.cpp +++ b/microkde/kutils/kcmultidialog.cpp | |||
@@ -1,49 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> | 2 | Copyright (c) 2000 Matthias Elter <elter@kde.org> |
3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> | 3 | Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qhbox.h> | 22 | #include <q3hbox.h> |
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | //Added by qt3to4: | ||
27 | #include <QPixmap> | ||
26 | 28 | ||
27 | #include <klocale.h> | 29 | #include <klocale.h> |
28 | #include <kglobal.h> | 30 | #include <kglobal.h> |
29 | #include <kdebug.h> | 31 | #include <kdebug.h> |
30 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
31 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
32 | //US #include <klibloader.h> | 34 | //US #include <klibloader.h> |
33 | #include <krun.h> | 35 | #include <krun.h> |
34 | #include <kprocess.h> | 36 | #include <kprocess.h> |
35 | #include <kglobalsettings.h> | 37 | #include <kglobalsettings.h> |
36 | 38 | ||
37 | #include "kcmultidialog.h" | 39 | #include "kcmultidialog.h" |
38 | //US #include "kcmultidialog.moc" | 40 | //US #include "kcmultidialog.moc" |
39 | //US #include "kcmoduleloader.h" | 41 | //US #include "kcmoduleloader.h" |
40 | 42 | ||
41 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) | 43 | KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) |
42 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, | 44 | : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, |
43 | parent, name, modal, true), d(0L) | 45 | parent, name, modal, true), d(0L) |
44 | { | 46 | { |
45 | setFont( KGlobalSettings::generalMaxFont() ); | 47 | setFont( KGlobalSettings::generalMaxFont() ); |
46 | enableButton(Apply, false); | 48 | enableButton(Apply, false); |
47 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); | 49 | //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); |
48 | 50 | ||
49 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); | 51 | connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); |
@@ -52,131 +54,131 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch | |||
52 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); | 54 | mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); |
53 | setMainWidget(mMainWidget ); | 55 | setMainWidget(mMainWidget ); |
54 | #ifdef DESKTOP_VERSION | 56 | #ifdef DESKTOP_VERSION |
55 | resize(640,480); | 57 | resize(640,480); |
56 | #else | 58 | #else |
57 | //resize(640,480); | 59 | //resize(640,480); |
58 | //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); | 60 | //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); |
59 | resize(800,800); | 61 | resize(800,800); |
60 | setMaximumSize( 800, 800 ); | 62 | setMaximumSize( 800, 800 ); |
61 | //showMaximized(); | 63 | //showMaximized(); |
62 | #endif | 64 | #endif |
63 | 65 | ||
64 | } | 66 | } |
65 | 67 | ||
66 | KCMultiDialog::~KCMultiDialog() | 68 | KCMultiDialog::~KCMultiDialog() |
67 | { | 69 | { |
68 | //US moduleDict.setAutoDelete(true); | 70 | //US moduleDict.setAutoDelete(true); |
69 | } | 71 | } |
70 | 72 | ||
71 | void KCMultiDialog::slotDefault() | 73 | void KCMultiDialog::slotDefault() |
72 | { | 74 | { |
73 | 75 | ||
74 | int curPageIndex = activePageIndex(); | 76 | int curPageIndex = activePageIndex(); |
75 | 77 | ||
76 | QPtrListIterator<KCModule> it(modules); | 78 | Q3PtrListIterator<KCModule> it(modules); |
77 | for (; it.current(); ++it) | 79 | for (; it.current(); ++it) |
78 | { | 80 | { |
79 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) | 81 | if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) |
80 | { | 82 | { |
81 | (*it)->defaults(); | 83 | (*it)->defaults(); |
82 | clientChanged(true); | 84 | clientChanged(true); |
83 | return; | 85 | return; |
84 | } | 86 | } |
85 | } | 87 | } |
86 | 88 | ||
87 | } | 89 | } |
88 | void KCMultiDialog::accept() | 90 | void KCMultiDialog::accept() |
89 | { | 91 | { |
90 | slotOk(); | 92 | slotOk(); |
91 | } | 93 | } |
92 | void KCMultiDialog::slotApply() | 94 | void KCMultiDialog::slotApply() |
93 | { | 95 | { |
94 | QPtrListIterator<KCModule> it(modules); | 96 | Q3PtrListIterator<KCModule> it(modules); |
95 | for (; it.current(); ++it) | 97 | for (; it.current(); ++it) |
96 | (*it)->save(); | 98 | (*it)->save(); |
97 | clientChanged(false); | 99 | clientChanged(false); |
98 | 100 | ||
99 | emit applyClicked(); | 101 | emit applyClicked(); |
100 | 102 | ||
101 | } | 103 | } |
102 | 104 | ||
103 | 105 | ||
104 | void KCMultiDialog::slotOk() | 106 | void KCMultiDialog::slotOk() |
105 | { | 107 | { |
106 | qDebug("KCMultiDialog::slotOk clicked"); | 108 | qDebug("KCMultiDialog::slotOk clicked"); |
107 | 109 | ||
108 | QPtrListIterator<KCModule> it(modules); | 110 | Q3PtrListIterator<KCModule> it(modules); |
109 | for (; it.current(); ++it) | 111 | for (; it.current(); ++it) |
110 | (*it)->save(); | 112 | (*it)->save(); |
111 | QDialog::accept(); | 113 | QDialog::accept(); |
112 | 114 | ||
113 | emit okClicked(); | 115 | emit okClicked(); |
114 | } | 116 | } |
115 | 117 | ||
116 | void KCMultiDialog::slotHelp() | 118 | void KCMultiDialog::slotHelp() |
117 | { | 119 | { |
118 | /*US | 120 | /*US |
119 | KURL url( KURL("help:/"), _docPath ); | 121 | KURL url( KURL("help:/"), _docPath ); |
120 | 122 | ||
121 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { | 123 | if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { |
122 | KProcess process; | 124 | KProcess process; |
123 | process << "khelpcenter" | 125 | process << "khelpcenter" |
124 | << url.url(); | 126 | << url.url(); |
125 | process.start(KProcess::DontCare); | 127 | process.start(KProcess::DontCare); |
126 | process.detach(); | 128 | process.detach(); |
127 | } else { | 129 | } else { |
128 | new KRun(url); | 130 | new KRun(url); |
129 | } | 131 | } |
130 | */ | 132 | */ |
131 | } | 133 | } |
132 | 134 | ||
133 | void KCMultiDialog::clientChanged(bool state) | 135 | void KCMultiDialog::clientChanged(bool state) |
134 | { | 136 | { |
135 | enableButton(Apply, state); | 137 | enableButton(Apply, state); |
136 | } | 138 | } |
137 | 139 | ||
138 | /*US | 140 | /*US |
139 | void KCMultiDialog::addModule(const QString& path, bool withfallback) | 141 | void KCMultiDialog::addModule(const QString& path, bool withfallback) |
140 | { | 142 | { |
141 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; | 143 | kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; |
142 | 144 | ||
143 | KCModuleInfo info(path, _baseGroup); | 145 | KCModuleInfo info(path, _baseGroup); |
144 | 146 | ||
145 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), | 147 | QHBox* page = addHBoxPage(info.moduleName(), info.comment(), |
146 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); | 148 | KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); |
147 | if(!page) { | 149 | if(!page) { |
148 | KCModuleLoader::unloadModule(info); | 150 | KCModuleLoader::unloadModule(info); |
149 | return; | 151 | return; |
150 | } | 152 | } |
151 | moduleDict.insert(page, new LoadInfo(path, withfallback)); | 153 | moduleDict.insert(page, new LoadInfo(path, withfallback)); |
152 | if (modules.isEmpty()) | 154 | if (modules.isEmpty()) |
153 | slotAboutToShow(page); | 155 | slotAboutToShow(page); |
154 | } | 156 | } |
155 | */ | 157 | */ |
156 | QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) | 158 | Q3VBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) |
157 | { | 159 | { |
158 | QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); | 160 | Q3VBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); |
159 | return page; | 161 | return page; |
160 | 162 | ||
161 | } | 163 | } |
162 | //US special method for microkde. We dop noty want to load everything dynamically. | 164 | //US special method for microkde. We dop noty want to load everything dynamically. |
163 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) | 165 | void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) |
164 | { | 166 | { |
165 | 167 | ||
166 | modules.append(module); | 168 | modules.append(module); |
167 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); | 169 | connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); |
168 | //US | 170 | //US |
169 | module->load(); | 171 | module->load(); |
170 | 172 | ||
171 | 173 | ||
172 | } | 174 | } |
173 | 175 | ||
174 | void KCMultiDialog::slotAboutToShow(QWidget *page) | 176 | void KCMultiDialog::slotAboutToShow(QWidget *page) |
175 | { | 177 | { |
176 | /*US | 178 | /*US |
177 | LoadInfo *loadInfo = moduleDict[page]; | 179 | LoadInfo *loadInfo = moduleDict[page]; |
178 | if (!loadInfo) | 180 | if (!loadInfo) |
179 | return; | 181 | return; |
180 | 182 | ||
181 | QApplication::setOverrideCursor(Qt::WaitCursor); | 183 | QApplication::setOverrideCursor(Qt::WaitCursor); |
182 | 184 | ||