summaryrefslogtreecommitdiffabout
path: root/microkde/kutils
authorulf69 <ulf69>2004-09-21 19:47:57 (UTC)
committer ulf69 <ulf69>2004-09-21 19:47:57 (UTC)
commitc2cce86fdb2d0b291c3d3bdfa9fac47452153d1a (patch) (unidiff)
tree6f8ac380b5db0831f02e4cc35cd0a6fd5ece5ff9 /microkde/kutils
parent427906b75a4672531f2b7d86b2a4a27427f5d4a4 (diff)
downloadkdepimpi-c2cce86fdb2d0b291c3d3bdfa9fac47452153d1a.zip
kdepimpi-c2cce86fdb2d0b291c3d3bdfa9fac47452153d1a.tar.gz
kdepimpi-c2cce86fdb2d0b291c3d3bdfa9fac47452153d1a.tar.bz2
added prefwriting prefreading for size and font object
Diffstat (limited to 'microkde/kutils') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kutils/kcmultidialog.cpp20
-rw-r--r--microkde/kutils/kcmultidialog.h5
2 files changed, 23 insertions, 2 deletions
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index e7aa9d1..c4ccede 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -38,65 +38,65 @@
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 //showMaximized(); 57 //showMaximized();
58#endif 58#endif
59 59
60} 60}
61 61
62KCMultiDialog::~KCMultiDialog() 62KCMultiDialog::~KCMultiDialog()
63{ 63{
64//US moduleDict.setAutoDelete(true); 64//US moduleDict.setAutoDelete(true);
65} 65}
66 66
67void KCMultiDialog::slotDefault() 67void KCMultiDialog::slotDefault()
68{ 68{
69 69
70 int curPageIndex = mMainWidget->activePageIndex(); 70 int curPageIndex = activePageIndex();
71 71
72 QPtrListIterator<KCModule> it(modules); 72 QPtrListIterator<KCModule> it(modules);
73 for (; it.current(); ++it) 73 for (; it.current(); ++it)
74 { 74 {
75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) 75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
76 { 76 {
77 (*it)->defaults(); 77 (*it)->defaults();
78 clientChanged(true); 78 clientChanged(true);
79 return; 79 return;
80 } 80 }
81 } 81 }
82 82
83} 83}
84void KCMultiDialog::accept() 84void KCMultiDialog::accept()
85{ 85{
86 slotOk(); 86 slotOk();
87} 87}
88void KCMultiDialog::slotApply() 88void KCMultiDialog::slotApply()
89{ 89{
90qDebug("KCMultiDialog::slotApply clicked"); 90qDebug("KCMultiDialog::slotApply clicked");
91 91
92 QPtrListIterator<KCModule> it(modules); 92 QPtrListIterator<KCModule> it(modules);
93 for (; it.current(); ++it) 93 for (; it.current(); ++it)
94 (*it)->save(); 94 (*it)->save();
95 clientChanged(false); 95 clientChanged(false);
96 96
97 emit applyClicked(); 97 emit applyClicked();
98 98
99} 99}
100 100
101 101
102void KCMultiDialog::slotOk() 102void KCMultiDialog::slotOk()
@@ -178,32 +178,50 @@ void KCMultiDialog::slotAboutToShow(QWidget *page)
178 178
179 QApplication::setOverrideCursor(Qt::WaitCursor); 179 QApplication::setOverrideCursor(Qt::WaitCursor);
180 180
181 moduleDict.remove(page); 181 moduleDict.remove(page);
182 182
183 KCModuleInfo info(loadInfo->path, _baseGroup); 183 KCModuleInfo info(loadInfo->path, _baseGroup);
184 184
185 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback); 185 KCModule *module = KCModuleLoader::loadModule(info, loadInfo->withfallback);
186 186
187 if (!module) 187 if (!module)
188 { 188 {
189 QApplication::restoreOverrideCursor(); 189 QApplication::restoreOverrideCursor();
190 KCModuleLoader::showLastLoaderError(this); 190 KCModuleLoader::showLastLoaderError(this);
191 delete loadInfo; 191 delete loadInfo;
192 return; 192 return;
193 } 193 }
194 194
195 module->reparent(page,0,QPoint(0,0),true); 195 module->reparent(page,0,QPoint(0,0),true);
196 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool))); 196 connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
197 //setHelp( docpath, QString::null ); 197 //setHelp( docpath, QString::null );
198 _docPath = info.docPath(); 198 _docPath = info.docPath();
199 modules.append(module); 199 modules.append(module);
200 200
201 //KCGlobal::repairAccels( topLevelWidget() ); 201 //KCGlobal::repairAccels( topLevelWidget() );
202 202
203 delete loadInfo; 203 delete loadInfo;
204 204
205 QApplication::restoreOverrideCursor(); 205 QApplication::restoreOverrideCursor();
206*/ 206*/
207 207
208qDebug("KCMultiDialog::slotAboutToShow not implemented"); 208qDebug("KCMultiDialog::slotAboutToShow not implemented");
209} 209}
210
211
212bool KCMultiDialog::showPage( int index )
213{
214 return(mMainWidget->showPage(index) );
215}
216
217
218int KCMultiDialog::activePageIndex() const
219{
220 return( mMainWidget->activePageIndex() );
221}
222
223
224int KCMultiDialog::pageIndex( QWidget *widget ) const
225{
226 return( mMainWidget->pageIndex( widget) );
227}
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index 768faea..66412ac 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -44,69 +44,72 @@ class KCMultiDialog : public KDialogBase
44 44
45public: 45public:
46 /** 46 /**
47 * Constructs a new KCMultiDialog 47 * Constructs a new KCMultiDialog
48 * 48 *
49 * @param parent The parent Widget 49 * @param parent The parent Widget
50 * @param name The widget name 50 * @param name The widget name
51 * @param baseGroup The baseGroup, if you want to call a module out of 51 * @param baseGroup The baseGroup, if you want to call a module out of
52 * kcontrol, just keep "settings" 52 * kcontrol, just keep "settings"
53 * @param modal If you pass true here, the dialog will be modal 53 * @param modal If you pass true here, the dialog will be modal
54 **/ 54 **/
55 KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"), 55 KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
56 QWidget *parent=0, const char *name=0, 56 QWidget *parent=0, const char *name=0,
57 bool modal=false); 57 bool modal=false);
58 58
59 /** 59 /**
60 * Destructor 60 * Destructor
61 **/ 61 **/
62 virtual ~KCMultiDialog(); 62 virtual ~KCMultiDialog();
63 63
64 /** 64 /**
65 * Add a module. 65 * Add a module.
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 dop noty 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 QVBox* getNewVBoxPage(const QString & modulename) ;
79 79
80 80
81 bool showPage( int index );
82 int activePageIndex() const;
83 int pageIndex( QWidget *widget ) const;
81 84
82protected slots: 85protected slots:
83 /** 86 /**
84 * This slot is called when the user presses the "Default" Button 87 * This slot is called when the user presses the "Default" Button
85 * You can reimplement it if needed. 88 * You can reimplement it if needed.
86 * 89 *
87 * @note Make sure you call the original implementation! 90 * @note Make sure you call the original implementation!
88 **/ 91 **/
89 virtual void slotDefault(); 92 virtual void slotDefault();
90 93
91 /** 94 /**
92 * This slot is called when the user presses the "Apply" Button 95 * This slot is called when the user presses the "Apply" Button
93 * You can reimplement it if needed 96 * You can reimplement it if needed
94 * 97 *
95 * @note Make sure you call the original implementation! 98 * @note Make sure you call the original implementation!
96 **/ 99 **/
97 virtual void slotApply(); 100 virtual void slotApply();
98 101
99 /** 102 /**
100 * This slot is called when the user presses the "OK" Button 103 * This slot is called when the user presses the "OK" Button
101 * You can reimplement it if needed 104 * You can reimplement it if needed
102 * 105 *
103 * @note Make sure you call the original implementation! 106 * @note Make sure you call the original implementation!
104 **/ 107 **/
105 virtual void slotOk(); 108 virtual void slotOk();
106 109
107 /** 110 /**
108 * This slot is called when the user presses the "Help" Button 111 * This slot is called when the user presses the "Help" Button
109 * You can reimplement it if needed 112 * You can reimplement it if needed
110 * 113 *
111 * @note Make sure you call the original implementation! 114 * @note Make sure you call the original implementation!
112 **/ 115 **/