summaryrefslogtreecommitdiffabout
path: root/microkde/kutils
authorzautrix <zautrix>2005-01-19 14:35:53 (UTC)
committer zautrix <zautrix>2005-01-19 14:35:53 (UTC)
commita9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (patch) (unidiff)
treea649fbc1c07e2c199833da1a23cf326d68406d4b /microkde/kutils
parent0d878a0144644499ead17b2532cc94abb545bcdb (diff)
downloadkdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.zip
kdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.tar.gz
kdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.tar.bz2
dislog size fixes
Diffstat (limited to 'microkde/kutils') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kutils/kcmultidialog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 248476f..4daa4ff 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,225 +1,227 @@
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 <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qcursor.h> 24#include <qcursor.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kglobal.h> 28#include <kglobal.h>
29#include <kdebug.h> 29#include <kdebug.h>
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kmessagebox.h> 31#include <kmessagebox.h>
32//US #include <klibloader.h> 32//US #include <klibloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kprocess.h> 34#include <kprocess.h>
35 35
36#include "kcmultidialog.h" 36#include "kcmultidialog.h"
37//US #include "kcmultidialog.moc" 37//US #include "kcmultidialog.moc"
38//US #include "kcmoduleloader.h" 38//US #include "kcmoduleloader.h"
39 39
40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal) 40KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
41 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok, 41 : KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
42 parent, name, modal, true), d(0L) 42 parent, name, modal, true), d(0L)
43{ 43{
44 enableButton(Apply, false); 44 enableButton(Apply, false);
45 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *))); 45 //connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
46 46
47 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) ); 47 connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
48 48
49 _baseGroup = baseGroup; 49 _baseGroup = baseGroup;
50 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed ); 50 mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
51 setMainWidget(mMainWidget ); 51 setMainWidget(mMainWidget );
52#ifdef DESKTOP_VERSION 52#ifdef DESKTOP_VERSION
53 resize(640,480); 53 resize(640,480);
54#else 54#else
55 resize(640,480); 55 //resize(640,480);
56 setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480)); 56 //setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
57 resize(800,800);
58 setMaximumSize( 800, 800 );
57 //showMaximized(); 59 //showMaximized();
58#endif 60#endif
59 61
60} 62}
61 63
62KCMultiDialog::~KCMultiDialog() 64KCMultiDialog::~KCMultiDialog()
63{ 65{
64//US moduleDict.setAutoDelete(true); 66//US moduleDict.setAutoDelete(true);
65} 67}
66 68
67void KCMultiDialog::slotDefault() 69void KCMultiDialog::slotDefault()
68{ 70{
69 71
70 int curPageIndex = activePageIndex(); 72 int curPageIndex = activePageIndex();
71 73
72 QPtrListIterator<KCModule> it(modules); 74 QPtrListIterator<KCModule> it(modules);
73 for (; it.current(); ++it) 75 for (; it.current(); ++it)
74 { 76 {
75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) 77 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
76 { 78 {
77 (*it)->defaults(); 79 (*it)->defaults();
78 clientChanged(true); 80 clientChanged(true);
79 return; 81 return;
80 } 82 }
81 } 83 }
82 84
83} 85}
84void KCMultiDialog::accept() 86void KCMultiDialog::accept()
85{ 87{
86 slotOk(); 88 slotOk();
87} 89}
88void KCMultiDialog::slotApply() 90void KCMultiDialog::slotApply()
89{ 91{
90 QPtrListIterator<KCModule> it(modules); 92 QPtrListIterator<KCModule> it(modules);
91 for (; it.current(); ++it) 93 for (; it.current(); ++it)
92 (*it)->save(); 94 (*it)->save();
93 clientChanged(false); 95 clientChanged(false);
94 96
95 emit applyClicked(); 97 emit applyClicked();
96 98
97} 99}
98 100
99 101
100void KCMultiDialog::slotOk() 102void KCMultiDialog::slotOk()
101{ 103{
102qDebug("KCMultiDialog::slotOk clicked"); 104qDebug("KCMultiDialog::slotOk clicked");
103 105
104 QPtrListIterator<KCModule> it(modules); 106 QPtrListIterator<KCModule> it(modules);
105 for (; it.current(); ++it) 107 for (; it.current(); ++it)
106 (*it)->save(); 108 (*it)->save();
107 QDialog::accept(); 109 QDialog::accept();
108 110
109 emit okClicked(); 111 emit okClicked();
110} 112}
111 113
112void KCMultiDialog::slotHelp() 114void KCMultiDialog::slotHelp()
113{ 115{
114/*US 116/*US
115 KURL url( KURL("help:/"), _docPath ); 117 KURL url( KURL("help:/"), _docPath );
116 118
117 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") { 119 if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
118 KProcess process; 120 KProcess process;
119 process << "khelpcenter" 121 process << "khelpcenter"
120 << url.url(); 122 << url.url();
121 process.start(KProcess::DontCare); 123 process.start(KProcess::DontCare);
122 process.detach(); 124 process.detach();
123 } else { 125 } else {
124 new KRun(url); 126 new KRun(url);
125 } 127 }
126*/ 128*/
127} 129}
128 130
129void KCMultiDialog::clientChanged(bool state) 131void KCMultiDialog::clientChanged(bool state)
130{ 132{
131 enableButton(Apply, state); 133 enableButton(Apply, state);
132} 134}
133 135
134/*US 136/*US
135void KCMultiDialog::addModule(const QString& path, bool withfallback) 137void KCMultiDialog::addModule(const QString& path, bool withfallback)
136{ 138{
137 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl; 139 kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
138 140
139 KCModuleInfo info(path, _baseGroup); 141 KCModuleInfo info(path, _baseGroup);
140 142
141 QHBox* page = addHBoxPage(info.moduleName(), info.comment(), 143 QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
142 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium)); 144 KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
143 if(!page) { 145 if(!page) {
144 KCModuleLoader::unloadModule(info); 146 KCModuleLoader::unloadModule(info);
145 return; 147 return;
146 } 148 }
147 moduleDict.insert(page, new LoadInfo(path, withfallback)); 149 moduleDict.insert(page, new LoadInfo(path, withfallback));
148 if (modules.isEmpty()) 150 if (modules.isEmpty())
149 slotAboutToShow(page); 151 slotAboutToShow(page);
150} 152}
151*/ 153*/
152QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename ) 154QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
153{ 155{
154 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() ); 156 QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
155 return page; 157 return page;
156 158
157} 159}
158//US special method for microkde. We dop noty want to load everything dynamically. 160//US special method for microkde. We dop noty want to load everything dynamically.
159void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname) 161void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
160{ 162{
161 163
162 modules.append(module); 164 modules.append(module);
163 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 165 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
164//US 166//US
165 module->load(); 167 module->load();
166 168
167 169
168} 170}
169 171
170void KCMultiDialog::slotAboutToShow(QWidget *page) 172void KCMultiDialog::slotAboutToShow(QWidget *page)
171{ 173{
172/*US 174/*US
173 LoadInfo *loadInfo = moduleDict[page]; 175 LoadInfo *loadInfo = moduleDict[page];
174 if (!loadInfo) 176 if (!loadInfo)
175 return; 177 return;
176 178
177 QApplication::setOverrideCursor(Qt::WaitCursor); 179 QApplication::setOverrideCursor(Qt::WaitCursor);
178 180
179 moduleDict.remove(page); 181 moduleDict.remove(page);
180 182
181 KCModuleInfo info(loadInfo->path, _baseGroup); 183 KCModuleInfo info(loadInfo->path, _baseGroup);
182 184
183 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); 185 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
184 186
185 if (!module) 187 if (!module)
186 { 188 {
187 QApplication::restoreOverrideCursor(); 189 QApplication::restoreOverrideCursor();
188 KCModuleLoader::showLastLoaderError(this); 190 KCModuleLoader::showLastLoaderError(this);
189 delete loadInfo; 191 delete loadInfo;
190 return; 192 return;
191 } 193 }
192 194
193 module->reparent(page,0,QPoint(0,0),true); 195 module->reparent(page,0,QPoint(0,0),true);
194 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 196 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
195 //setHelp( docpath, QString::null ); 197 //setHelp( docpath, QString::null );
196 _docPath = info.docPath(); 198 _docPath = info.docPath();
197 modules.append(module); 199 modules.append(module);
198 200
199 //KCGlobal::repairAccels( topLevelWidget() ); 201 //KCGlobal::repairAccels( topLevelWidget() );
200 202
201 delete loadInfo; 203 delete loadInfo;
202 204
203 QApplication::restoreOverrideCursor(); 205 QApplication::restoreOverrideCursor();
204*/ 206*/
205 207
206qDebug("KCMultiDialog::slotAboutToShow not implemented"); 208qDebug("KCMultiDialog::slotAboutToShow not implemented");
207} 209}
208 210
209 211
210bool KCMultiDialog::showPage( int index ) 212bool KCMultiDialog::showPage( int index )
211{ 213{
212 return(mMainWidget->showPage(index) ); 214 return(mMainWidget->showPage(index) );
213} 215}
214 216
215 217
216int KCMultiDialog::activePageIndex() const 218int KCMultiDialog::activePageIndex() const
217{ 219{
218 return( mMainWidget->activePageIndex() ); 220 return( mMainWidget->activePageIndex() );
219} 221}
220 222
221 223
222int KCMultiDialog::pageIndex( QWidget *widget ) const 224int KCMultiDialog::pageIndex( QWidget *widget ) const
223{ 225{
224 return( mMainWidget->pageIndex( widget) ); 226 return( mMainWidget->pageIndex( widget) );
225} 227}