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/kresources/configpage.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kresources/configpage.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/configpage.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index fc7a42e..1a9d063 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp | |||
@@ -15,108 +15,112 @@ | |||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | Library General Public License for more details. | 16 | Library General Public License for more details. |
17 | 17 | ||
18 | You should have received a copy of the GNU Library General Public License | 18 | You should have received a copy of the GNU Library General Public License |
19 | along with this library; see the file COPYING.LIB. If not, write to | 19 | along with this library; see the file COPYING.LIB. If not, write to |
20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 20 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 21 | Boston, MA 02111-1307, USA. |
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 <qgroupbox.h> | 31 | #include <q3groupbox.h> |
32 | 32 | ||
33 | #ifdef DESKTOP_VERSION | 33 | #ifdef DESKTOP_VERSION |
34 | #include <qinputdialog.h> | 34 | #include <qinputdialog.h> |
35 | #else | 35 | #else |
36 | #include <qtcompat/qinputdialog.h> | 36 | #include <qtcompat/qinputdialog.h> |
37 | #endif | 37 | #endif |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3GridLayout> | ||
42 | #include <Q3ValueList> | ||
43 | #include <Q3VBoxLayout> | ||
40 | #include <kapplication.h> | 44 | #include <kapplication.h> |
41 | #include <kcombobox.h> | 45 | #include <kcombobox.h> |
42 | #include <kdebug.h> | 46 | #include <kdebug.h> |
43 | #include <klocale.h> | 47 | #include <klocale.h> |
44 | #include <kmessagebox.h> | 48 | #include <kmessagebox.h> |
45 | #include <ksimpleconfig.h> | 49 | #include <ksimpleconfig.h> |
46 | #include <kstandarddirs.h> | 50 | #include <kstandarddirs.h> |
47 | #include <kurlrequester.h> | 51 | #include <kurlrequester.h> |
48 | #include <klistview.h> | 52 | #include <klistview.h> |
49 | #include <kbuttonbox.h> | 53 | #include <kbuttonbox.h> |
50 | //US #include <ktrader.h> | 54 | //US #include <ktrader.h> |
51 | 55 | ||
52 | #include "resource.h" | 56 | #include "resource.h" |
53 | #include "configdialog.h" | 57 | #include "configdialog.h" |
54 | 58 | ||
55 | #include "configpage.h" | 59 | #include "configpage.h" |
56 | 60 | ||
57 | //US | 61 | //US |
58 | #include <qpushbutton.h> | 62 | #include <qpushbutton.h> |
59 | #include <qfile.h> | 63 | #include <qfile.h> |
60 | #include <kglobal.h> | 64 | #include <kglobal.h> |
61 | 65 | ||
62 | using namespace KRES; | 66 | using namespace KRES; |
63 | 67 | ||
64 | class ConfigViewItem : public QCheckListItem | 68 | class ConfigViewItem : public Q3CheckListItem |
65 | { | 69 | { |
66 | public: | 70 | public: |
67 | ConfigViewItem( QListView *parent, Resource* resource ) : | 71 | ConfigViewItem( Q3ListView *parent, Resource* resource ) : |
68 | QCheckListItem( parent, resource->resourceName(), CheckBox ), | 72 | Q3CheckListItem( parent, resource->resourceName(), CheckBox ), |
69 | mResource( resource ), | 73 | mResource( resource ), |
70 | mIsStandard( false ) | 74 | mIsStandard( false ) |
71 | { | 75 | { |
72 | setText( 1, mResource->type() ); | 76 | setText( 1, mResource->type() ); |
73 | setOn( mResource->isActive() ); | 77 | setOn( mResource->isActive() ); |
74 | } | 78 | } |
75 | 79 | ||
76 | void setStandard( bool value ) | 80 | void setStandard( bool value ) |
77 | { | 81 | { |
78 | setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); | 82 | setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); |
79 | mIsStandard = value; | 83 | mIsStandard = value; |
80 | } | 84 | } |
81 | 85 | ||
82 | bool standard() const { return mIsStandard; } | 86 | bool standard() const { return mIsStandard; } |
83 | bool readOnly() const { return mResource->readOnly(); } | 87 | bool readOnly() const { return mResource->readOnly(); } |
84 | 88 | ||
85 | Resource *resource() { return mResource; } | 89 | Resource *resource() { return mResource; } |
86 | 90 | ||
87 | private: | 91 | private: |
88 | Resource* mResource; | 92 | Resource* mResource; |
89 | 93 | ||
90 | bool mIsStandard; | 94 | bool mIsStandard; |
91 | }; | 95 | }; |
92 | 96 | ||
93 | ConfigPage::ConfigPage( QWidget *parent, const char *name ) | 97 | ConfigPage::ConfigPage( QWidget *parent, const char *name ) |
94 | : QWidget( parent, name ), | 98 | : QWidget( parent, name ), |
95 | mCurrentManager( 0 ), | 99 | mCurrentManager( 0 ), |
96 | mCurrentConfig( 0 ) | 100 | mCurrentConfig( 0 ) |
97 | { | 101 | { |
98 | setCaption( i18n( "Resource Configuration" ) ); | 102 | setCaption( i18n( "Resource Configuration" ) ); |
99 | 103 | ||
100 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 104 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this ); |
101 | 105 | ||
102 | QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this ); | 106 | Q3GroupBox *groupBox = new Q3GroupBox( i18n( "Resources" ), this ); |
103 | groupBox->setColumnLayout(0, Qt::Vertical ); | 107 | groupBox->setColumnLayout(0, Qt::Vertical ); |
104 | groupBox->layout()->setSpacing( 3 ); | 108 | groupBox->layout()->setSpacing( 3 ); |
105 | groupBox->layout()->setMargin( 5 ); | 109 | groupBox->layout()->setMargin( 5 ); |
106 | QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 ); | 110 | Q3GridLayout *groupBoxLayout = new Q3GridLayout( groupBox->layout(), 4, 2 ); |
107 | 111 | ||
108 | //US mFamilyCombo = new KComboBox( false, groupBox ); | 112 | //US mFamilyCombo = new KComboBox( false, groupBox ); |
109 | mFamilyCombo = new KComboBox( groupBox ); | 113 | mFamilyCombo = new KComboBox( groupBox ); |
110 | groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); | 114 | groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); |
111 | 115 | ||
112 | mListView = new KListView( groupBox ); | 116 | mListView = new KListView( groupBox ); |
113 | mListView->setAllColumnsShowFocus( true ); | 117 | mListView->setAllColumnsShowFocus( true ); |
114 | mListView->addColumn( i18n( "Name" ) ); | 118 | mListView->addColumn( i18n( "Name" ) ); |
115 | mListView->addColumn( i18n( "Type" ) ); | 119 | mListView->addColumn( i18n( "Type" ) ); |
116 | mListView->addColumn( i18n( "Standard" ) ); | 120 | mListView->addColumn( i18n( "Standard" ) ); |
117 | 121 | ||
118 | //US groupBoxLayout->addWidget( mListView, 1, 0 ); | 122 | //US groupBoxLayout->addWidget( mListView, 1, 0 ); |
119 | groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); | 123 | groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); |
120 | 124 | ||
121 | 125 | ||
122 | mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); | 126 | mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); |
@@ -132,47 +136,47 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) | |||
132 | mEditButton->setEnabled( false ); | 136 | mEditButton->setEnabled( false ); |
133 | mStandardButton->setEnabled( false ); | 137 | mStandardButton->setEnabled( false ); |
134 | 138 | ||
135 | 139 | ||
136 | connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) ); | 140 | connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) ); |
137 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) ); | 141 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) ); |
138 | connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) ); | 142 | connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) ); |
139 | connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) ); | 143 | connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) ); |
140 | 144 | ||
141 | 145 | ||
142 | mainLayout->addWidget( groupBox ); | 146 | mainLayout->addWidget( groupBox ); |
143 | 147 | ||
144 | connect( mFamilyCombo, SIGNAL( activated( int ) ), | 148 | connect( mFamilyCombo, SIGNAL( activated( int ) ), |
145 | SLOT( slotFamilyChanged( int ) ) ); | 149 | SLOT( slotFamilyChanged( int ) ) ); |
146 | connect( mListView, SIGNAL( selectionChanged() ), | 150 | connect( mListView, SIGNAL( selectionChanged() ), |
147 | SLOT( slotSelectionChanged() ) ); | 151 | SLOT( slotSelectionChanged() ) ); |
148 | connect( mListView, SIGNAL( clicked( QListViewItem * ) ), | 152 | connect( mListView, SIGNAL( clicked( Q3ListViewItem * ) ), |
149 | SLOT( slotItemClicked( QListViewItem * ) ) ); | 153 | SLOT( slotItemClicked( Q3ListViewItem * ) ) ); |
150 | 154 | ||
151 | mLastItem = 0; | 155 | mLastItem = 0; |
152 | 156 | ||
153 | //US mConfig = new KConfig( "kcmkresourcesrc" ); | 157 | //US mConfig = new KConfig( "kcmkresourcesrc" ); |
154 | mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") ); | 158 | mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") ); |
155 | mConfig->setGroup( "General" ); | 159 | mConfig->setGroup( "General" ); |
156 | 160 | ||
157 | load(); | 161 | load(); |
158 | } | 162 | } |
159 | 163 | ||
160 | ConfigPage::~ConfigPage() | 164 | ConfigPage::~ConfigPage() |
161 | { | 165 | { |
162 | QValueList<ResourcePageInfo>::Iterator it; | 166 | Q3ValueList<ResourcePageInfo>::Iterator it; |
163 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) { | 167 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) { |
164 | (*it).mManager->removeListener( this ); | 168 | (*it).mManager->removeListener( this ); |
165 | delete (*it).mManager; | 169 | delete (*it).mManager; |
166 | delete (*it).mConfig; | 170 | delete (*it).mConfig; |
167 | } | 171 | } |
168 | 172 | ||
169 | mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); | 173 | mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); |
170 | delete mConfig; | 174 | delete mConfig; |
171 | mConfig = 0; | 175 | mConfig = 0; |
172 | } | 176 | } |
173 | 177 | ||
174 | void ConfigPage::load() | 178 | void ConfigPage::load() |
175 | { | 179 | { |
176 | kdDebug(5650) << "ConfigPage::load()" << endl; | 180 | kdDebug(5650) << "ConfigPage::load()" << endl; |
177 | 181 | ||
178 | mListView->clear(); | 182 | mListView->clear(); |
@@ -217,33 +221,33 @@ void ConfigPage::load() | |||
217 | } | 221 | } |
218 | } | 222 | } |
219 | } | 223 | } |
220 | mCurrentManager = 0; | 224 | mCurrentManager = 0; |
221 | 225 | ||
222 | mFamilyCombo->insertStringList( mFamilyMap ); | 226 | mFamilyCombo->insertStringList( mFamilyMap ); |
223 | 227 | ||
224 | int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 ); | 228 | int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 ); |
225 | mFamilyCombo->setCurrentItem( currentFamily ); | 229 | mFamilyCombo->setCurrentItem( currentFamily ); |
226 | slotFamilyChanged( currentFamily ); | 230 | slotFamilyChanged( currentFamily ); |
227 | } | 231 | } |
228 | 232 | ||
229 | void ConfigPage::save() | 233 | void ConfigPage::save() |
230 | { | 234 | { |
231 | saveResourceSettings(); | 235 | saveResourceSettings(); |
232 | 236 | ||
233 | QValueList<ResourcePageInfo>::Iterator it; | 237 | Q3ValueList<ResourcePageInfo>::Iterator it; |
234 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) | 238 | for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) |
235 | (*it).mManager->writeConfig( (*it).mConfig ); | 239 | (*it).mManager->writeConfig( (*it).mConfig ); |
236 | 240 | ||
237 | emit changed( false ); | 241 | emit changed( false ); |
238 | } | 242 | } |
239 | 243 | ||
240 | void ConfigPage::defaults() | 244 | void ConfigPage::defaults() |
241 | { | 245 | { |
242 | } | 246 | } |
243 | 247 | ||
244 | void ConfigPage::slotFamilyChanged( int pos ) | 248 | void ConfigPage::slotFamilyChanged( int pos ) |
245 | { | 249 | { |
246 | if ( pos < 0 || pos >= (int)mFamilyMap.count() ) | 250 | if ( pos < 0 || pos >= (int)mFamilyMap.count() ) |
247 | return; | 251 | return; |
248 | 252 | ||
249 | saveResourceSettings(); | 253 | saveResourceSettings(); |
@@ -328,85 +332,85 @@ void ConfigPage::slotAdd() | |||
328 | 332 | ||
329 | resource->setResourceName( type + "-resource" ); | 333 | resource->setResourceName( type + "-resource" ); |
330 | 334 | ||
331 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 335 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
332 | 336 | ||
333 | if ( dlg.exec() ) { | 337 | if ( dlg.exec() ) { |
334 | mCurrentManager->add( resource ); | 338 | mCurrentManager->add( resource ); |
335 | 339 | ||
336 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); | 340 | ConfigViewItem *item = new ConfigViewItem( mListView, resource ); |
337 | 341 | ||
338 | mLastItem = item; | 342 | mLastItem = item; |
339 | 343 | ||
340 | // if there are only read-only resources we'll set this resource | 344 | // if there are only read-only resources we'll set this resource |
341 | // as standard resource | 345 | // as standard resource |
342 | if ( !resource->readOnly() ) { | 346 | if ( !resource->readOnly() ) { |
343 | bool onlyReadOnly = true; | 347 | bool onlyReadOnly = true; |
344 | QListViewItem *it = mListView->firstChild(); | 348 | Q3ListViewItem *it = mListView->firstChild(); |
345 | while ( it != 0 ) { | 349 | while ( it != 0 ) { |
346 | ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it ); | 350 | ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it ); |
347 | if ( !confIt->readOnly() && confIt != item ) | 351 | if ( !confIt->readOnly() && confIt != item ) |
348 | onlyReadOnly = false; | 352 | onlyReadOnly = false; |
349 | 353 | ||
350 | it = it->itemBelow(); | 354 | it = it->itemBelow(); |
351 | } | 355 | } |
352 | 356 | ||
353 | if ( onlyReadOnly ) | 357 | if ( onlyReadOnly ) |
354 | item->setStandard( true ); | 358 | item->setStandard( true ); |
355 | } | 359 | } |
356 | 360 | ||
357 | emit changed( true ); | 361 | emit changed( true ); |
358 | } else { | 362 | } else { |
359 | delete resource; | 363 | delete resource; |
360 | resource = 0; | 364 | resource = 0; |
361 | } | 365 | } |
362 | } | 366 | } |
363 | 367 | ||
364 | void ConfigPage::slotRemove() | 368 | void ConfigPage::slotRemove() |
365 | { | 369 | { |
366 | if ( !mCurrentManager ) | 370 | if ( !mCurrentManager ) |
367 | return; | 371 | return; |
368 | 372 | ||
369 | QListViewItem *item = mListView->currentItem(); | 373 | Q3ListViewItem *item = mListView->currentItem(); |
370 | ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item ); | 374 | ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item ); |
371 | 375 | ||
372 | if ( !confItem ) | 376 | if ( !confItem ) |
373 | return; | 377 | return; |
374 | 378 | ||
375 | if ( confItem->standard() ) { | 379 | if ( confItem->standard() ) { |
376 | KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) ); | 380 | KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) ); |
377 | return; | 381 | return; |
378 | } | 382 | } |
379 | 383 | ||
380 | mCurrentManager->remove( confItem->resource() ); | 384 | mCurrentManager->remove( confItem->resource() ); |
381 | 385 | ||
382 | if ( item == mLastItem ) | 386 | if ( item == mLastItem ) |
383 | mLastItem = 0; | 387 | mLastItem = 0; |
384 | 388 | ||
385 | mListView->takeItem( item ); | 389 | mListView->takeItem( item ); |
386 | delete item; | 390 | delete item; |
387 | 391 | ||
388 | emit changed( true ); | 392 | emit changed( true ); |
389 | } | 393 | } |
390 | 394 | ||
391 | void ConfigPage::slotEdit() | 395 | void ConfigPage::slotEdit() |
392 | { | 396 | { |
393 | if ( !mCurrentManager ) | 397 | if ( !mCurrentManager ) |
394 | return; | 398 | return; |
395 | 399 | ||
396 | QListViewItem *item = mListView->currentItem(); | 400 | Q3ListViewItem *item = mListView->currentItem(); |
397 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); | 401 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); |
398 | if ( !configItem ) | 402 | if ( !configItem ) |
399 | return; | 403 | return; |
400 | 404 | ||
401 | Resource *resource = configItem->resource(); | 405 | Resource *resource = configItem->resource(); |
402 | 406 | ||
403 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); | 407 | ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); |
404 | 408 | ||
405 | if ( dlg.exec() ) { | 409 | if ( dlg.exec() ) { |
406 | configItem->setText( 0, resource->resourceName() ); | 410 | configItem->setText( 0, resource->resourceName() ); |
407 | configItem->setText( 1, resource->type() ); | 411 | configItem->setText( 1, resource->type() ); |
408 | 412 | ||
409 | if ( configItem->standard() && configItem->readOnly() ) { | 413 | if ( configItem->standard() && configItem->readOnly() ) { |
410 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) ); | 414 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) ); |
411 | configItem->setStandard( false ); | 415 | configItem->setStandard( false ); |
412 | } | 416 | } |
@@ -422,33 +426,33 @@ void ConfigPage::slotStandard() | |||
422 | return; | 426 | return; |
423 | 427 | ||
424 | ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); | 428 | ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); |
425 | if ( !item ) | 429 | if ( !item ) |
426 | return; | 430 | return; |
427 | 431 | ||
428 | if ( item->readOnly() ) { | 432 | if ( item->readOnly() ) { |
429 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) ); | 433 | KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) ); |
430 | return; | 434 | return; |
431 | } | 435 | } |
432 | 436 | ||
433 | if ( !item->isOn() ) { | 437 | if ( !item->isOn() ) { |
434 | KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) ); | 438 | KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) ); |
435 | return; | 439 | return; |
436 | } | 440 | } |
437 | 441 | ||
438 | QListViewItem *it = mListView->firstChild(); | 442 | Q3ListViewItem *it = mListView->firstChild(); |
439 | while ( it != 0 ) { | 443 | while ( it != 0 ) { |
440 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); | 444 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); |
441 | if ( configItem->standard() ) | 445 | if ( configItem->standard() ) |
442 | configItem->setStandard( false ); | 446 | configItem->setStandard( false ); |
443 | it = it->itemBelow(); | 447 | it = it->itemBelow(); |
444 | } | 448 | } |
445 | 449 | ||
446 | item->setStandard( true ); | 450 | item->setStandard( true ); |
447 | mCurrentManager->setStandardResource( item->resource() ); | 451 | mCurrentManager->setStandardResource( item->resource() ); |
448 | emit changed( true ); | 452 | emit changed( true ); |
449 | 453 | ||
450 | } | 454 | } |
451 | 455 | ||
452 | void ConfigPage::slotSelectionChanged() | 456 | void ConfigPage::slotSelectionChanged() |
453 | { | 457 | { |
454 | bool state = ( mListView->currentItem() != 0 ); | 458 | bool state = ( mListView->currentItem() != 0 ); |
@@ -469,55 +473,55 @@ void ConfigPage::resourceAdded( Resource* resource ) | |||
469 | 473 | ||
470 | mLastItem = item; | 474 | mLastItem = item; |
471 | 475 | ||
472 | emit changed( true ); | 476 | emit changed( true ); |
473 | } | 477 | } |
474 | 478 | ||
475 | void ConfigPage::resourceModified( Resource* resource ) | 479 | void ConfigPage::resourceModified( Resource* resource ) |
476 | { | 480 | { |
477 | qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); | 481 | qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); |
478 | } | 482 | } |
479 | 483 | ||
480 | void ConfigPage::resourceDeleted( Resource* resource ) | 484 | void ConfigPage::resourceDeleted( Resource* resource ) |
481 | { | 485 | { |
482 | qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); | 486 | qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); |
483 | } | 487 | } |
484 | 488 | ||
485 | void ConfigPage::slotItemClicked( QListViewItem *item ) | 489 | void ConfigPage::slotItemClicked( Q3ListViewItem *item ) |
486 | { | 490 | { |
487 | ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); | 491 | ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); |
488 | if ( !configItem ) return; | 492 | if ( !configItem ) return; |
489 | 493 | ||
490 | if ( configItem->standard() && !configItem->isOn() ) { | 494 | if ( configItem->standard() && !configItem->isOn() ) { |
491 | KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) ); | 495 | KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) ); |
492 | configItem->setOn( true ); | 496 | configItem->setOn( true ); |
493 | return; | 497 | return; |
494 | } | 498 | } |
495 | 499 | ||
496 | if ( configItem->isOn() != configItem->resource()->isActive() ) { | 500 | if ( configItem->isOn() != configItem->resource()->isActive() ) { |
497 | emit changed( true ); | 501 | emit changed( true ); |
498 | } | 502 | } |
499 | } | 503 | } |
500 | 504 | ||
501 | void ConfigPage::saveResourceSettings() | 505 | void ConfigPage::saveResourceSettings() |
502 | { | 506 | { |
503 | //qDebug("ConfigPage::saveResourceSettings() begin"); | 507 | //qDebug("ConfigPage::saveResourceSettings() begin"); |
504 | 508 | ||
505 | if ( mCurrentManager ) { | 509 | if ( mCurrentManager ) { |
506 | 510 | ||
507 | QListViewItem *item = mListView->firstChild(); | 511 | Q3ListViewItem *item = mListView->firstChild(); |
508 | while ( item ) { | 512 | while ( item ) { |
509 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); | 513 | ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); |
510 | 514 | ||
511 | // check if standard resource | 515 | // check if standard resource |
512 | if ( configItem->standard() && !configItem->readOnly() && | 516 | if ( configItem->standard() && !configItem->readOnly() && |
513 | configItem->isOn() ) { | 517 | configItem->isOn() ) { |
514 | 518 | ||
515 | mCurrentManager->setStandardResource( configItem->resource() ); | 519 | mCurrentManager->setStandardResource( configItem->resource() ); |
516 | } | 520 | } |
517 | 521 | ||
518 | // check if active or passive resource | 522 | // check if active or passive resource |
519 | configItem->resource()->setActive( configItem->isOn() ); | 523 | configItem->resource()->setActive( configItem->isOn() ); |
520 | 524 | ||
521 | item = item->nextSibling(); | 525 | item = item->nextSibling(); |
522 | } | 526 | } |
523 | mCurrentManager->writeConfig( mCurrentConfig ); | 527 | mCurrentManager->writeConfig( mCurrentConfig ); |