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 | |||
@@ -25,21 +25,25 @@ | |||
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> |
@@ -58,17 +62,17 @@ $Id$ | |||
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 | } |
@@ -94,19 +98,19 @@ 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 ); |
@@ -142,27 +146,27 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) | |||
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 | ||
@@ -227,13 +231,13 @@ void ConfigPage::load() | |||
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 | ||
@@ -338,13 +342,13 @@ void ConfigPage::slotAdd() | |||
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(); |
@@ -363,13 +367,13 @@ void ConfigPage::slotAdd() | |||
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() ) { |
@@ -390,13 +394,13 @@ void ConfigPage::slotRemove() | |||
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 | ||
@@ -432,13 +436,13 @@ void ConfigPage::slotStandard() | |||
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 | } |
@@ -479,13 +483,13 @@ void ConfigPage::resourceModified( Resource* resource ) | |||
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." ) ); |
@@ -501,13 +505,13 @@ void ConfigPage::slotItemClicked( QListViewItem *item ) | |||
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() ) { |