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 | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kutils/kcmultidialog.cpp | 16 | ||||
-rw-r--r-- | microkde/kutils/kcmultidialog.h | 8 |
2 files changed, 13 insertions, 11 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 | |||
@@ -10,28 +10,30 @@ | |||
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" |
@@ -64,57 +66,57 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch | |||
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 | ||
@@ -144,27 +146,27 @@ void KCMultiDialog::addModule(const QString& path, bool withfallback) | |||
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 | ||
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h index 66412ac..78f8a00 100644 --- a/microkde/kutils/kcmultidialog.h +++ b/microkde/kutils/kcmultidialog.h | |||
@@ -13,26 +13,26 @@ | |||
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 | #ifndef KCMULTIDIALOG_H | 22 | #ifndef KCMULTIDIALOG_H |
23 | #define KCMULTIDIALOG_H | 23 | #define KCMULTIDIALOG_H |
24 | 24 | ||
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | #include <qptrdict.h> | 26 | #include <q3ptrdict.h> |
27 | 27 | ||
28 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
29 | #include <kjanuswidget.h> | 29 | #include <kjanuswidget.h> |
30 | #include <kcmodule.h> | 30 | #include <kcmodule.h> |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules | 33 | * A class that offers a @ref KDialogBase containing arbitrary KControl Modules |
34 | * | 34 | * |
35 | * @short A method that offers a @ref KDialogBase containing arbitrary | 35 | * @short A method that offers a @ref KDialogBase containing arbitrary |
36 | * KControl Modules. | 36 | * KControl Modules. |
37 | * | 37 | * |
38 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> | 38 | * @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org> |
@@ -66,25 +66,25 @@ public: | |||
66 | * | 66 | * |
67 | * @param module Specify the name of the module that is to be added | 67 | * @param module Specify the name of the module that is to be added |
68 | * to the list of modules the dialog will show. | 68 | * to the list of modules the dialog will show. |
69 | * | 69 | * |
70 | * @param withfallback Try harder to load the module. Might result | 70 | * @param withfallback Try harder to load the module. Might result |
71 | * in the module appearing outside the dialog. | 71 | * in the module appearing outside the dialog. |
72 | **/ | 72 | **/ |
73 | //US void addModule(const QString& module, bool withfallback=true); | 73 | //US void addModule(const QString& module, bool withfallback=true); |
74 | 74 | ||
75 | 75 | ||
76 | //US special method for microkde. We do not want to load everything dynamically. | 76 | //US special method for microkde. We do not want to load everything dynamically. |
77 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); | 77 | void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); |
78 | QVBox* getNewVBoxPage(const QString & modulename) ; | 78 | Q3VBox* getNewVBoxPage(const QString & modulename) ; |
79 | 79 | ||
80 | 80 | ||
81 | bool showPage( int index ); | 81 | bool showPage( int index ); |
82 | int activePageIndex() const; | 82 | int activePageIndex() const; |
83 | int pageIndex( QWidget *widget ) const; | 83 | int pageIndex( QWidget *widget ) const; |
84 | 84 | ||
85 | protected slots: | 85 | protected slots: |
86 | /** | 86 | /** |
87 | * This slot is called when the user presses the "Default" Button | 87 | * This slot is called when the user presses the "Default" Button |
88 | * You can reimplement it if needed. | 88 | * You can reimplement it if needed. |
89 | * | 89 | * |
90 | * @note Make sure you call the original implementation! | 90 | * @note Make sure you call the original implementation! |
@@ -124,25 +124,25 @@ private slots: | |||
124 | void clientChanged(bool state); | 124 | void clientChanged(bool state); |
125 | 125 | ||
126 | private: | 126 | private: |
127 | /*US | 127 | /*US |
128 | struct LoadInfo { | 128 | struct LoadInfo { |
129 | LoadInfo(const QString &_path, bool _withfallback) | 129 | LoadInfo(const QString &_path, bool _withfallback) |
130 | : path(_path), withfallback(_withfallback) | 130 | : path(_path), withfallback(_withfallback) |
131 | { } | 131 | { } |
132 | QString path; | 132 | QString path; |
133 | bool withfallback; | 133 | bool withfallback; |
134 | }; | 134 | }; |
135 | */ | 135 | */ |
136 | QPtrList<KCModule> modules; | 136 | Q3PtrList<KCModule> modules; |
137 | /* | 137 | /* |
138 | QPtrDict<LoadInfo> moduleDict; | 138 | QPtrDict<LoadInfo> moduleDict; |
139 | QString _docPath; | 139 | QString _docPath; |
140 | */ | 140 | */ |
141 | QString _baseGroup; | 141 | QString _baseGroup; |
142 | 142 | ||
143 | //US | 143 | //US |
144 | KJanusWidget* mMainWidget; | 144 | KJanusWidget* mMainWidget; |
145 | 145 | ||
146 | // For future use | 146 | // For future use |
147 | class KCMultiDialogPrivate; | 147 | class KCMultiDialogPrivate; |
148 | KCMultiDialogPrivate *d; | 148 | KCMultiDialogPrivate *d; |