-rw-r--r-- | microkde/kresources/configdialog.cpp | 17 | ||||
-rw-r--r-- | microkde/kresources/configpage.cpp | 38 | ||||
-rw-r--r-- | microkde/kresources/configpage.h | 10 | ||||
-rw-r--r-- | microkde/kresources/factory.cpp | 6 | ||||
-rw-r--r-- | microkde/kresources/factory.h | 4 | ||||
-rw-r--r-- | microkde/kresources/kcmkresources.cpp | 7 | ||||
-rw-r--r-- | microkde/kresources/manager.h | 8 | ||||
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 10 | ||||
-rw-r--r-- | microkde/kresources/managerimpl.h | 8 | ||||
-rw-r--r-- | microkde/kresources/resource.h | 4 | ||||
-rw-r--r-- | microkde/kresources/selectdialog.cpp | 22 | ||||
-rw-r--r-- | microkde/kresources/selectdialog.h | 10 |
12 files changed, 82 insertions, 62 deletions
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp index 55253c0..4820faf 100644 --- a/microkde/kresources/configdialog.cpp +++ b/microkde/kresources/configdialog.cpp | |||
@@ -16,82 +16,85 @@ | |||
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 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | #include <kmessagebox.h> | 26 | #include <kmessagebox.h> |
27 | 27 | ||
28 | #include <qgroupbox.h> | 28 | #include <q3groupbox.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvbox.h> | 32 | #include <q3vbox.h> |
33 | 33 | ||
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qscrollview.h> | 35 | #include <q3scrollview.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3VBoxLayout> | ||
38 | #include <Q3Frame> | ||
36 | 39 | ||
37 | #include <kbuttonbox.h> | 40 | #include <kbuttonbox.h> |
38 | #include <kdialog.h> | 41 | #include <kdialog.h> |
39 | #include <klineedit.h> | 42 | #include <klineedit.h> |
40 | 43 | ||
41 | #include "factory.h" | 44 | #include "factory.h" |
42 | #include "configwidget.h" | 45 | #include "configwidget.h" |
43 | #include "configdialog.h" | 46 | #include "configdialog.h" |
44 | 47 | ||
45 | using namespace KRES; | 48 | using namespace KRES; |
46 | 49 | ||
47 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, | 50 | ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, |
48 | Resource* resource, const char *name ) | 51 | Resource* resource, const char *name ) |
49 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), | 52 | : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), |
50 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) | 53 | Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) |
51 | { | 54 | { |
52 | 55 | ||
53 | Factory *factory = Factory::self( resourceFamily ); | 56 | Factory *factory = Factory::self( resourceFamily ); |
54 | 57 | ||
55 | //US resize( 250, 240 ); | 58 | //US resize( 250, 240 ); |
56 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); | 59 | resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); |
57 | 60 | ||
58 | QFrame *main; | 61 | Q3Frame *main; |
59 | 62 | ||
60 | main = plainPage(); | 63 | main = plainPage(); |
61 | 64 | ||
62 | QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); | 65 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main, 0, spacingHint() ); |
63 | 66 | ||
64 | 67 | ||
65 | QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 68 | Q3GroupBox *generalGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
66 | generalGroupBox->layout()->setSpacing( spacingHint() ); | 69 | generalGroupBox->layout()->setSpacing( spacingHint() ); |
67 | generalGroupBox->setTitle( i18n( "General Settings" ) ); | 70 | generalGroupBox->setTitle( i18n( "General Settings" ) ); |
68 | 71 | ||
69 | new QLabel( i18n( "Name:" ), generalGroupBox ); | 72 | new QLabel( i18n( "Name:" ), generalGroupBox ); |
70 | 73 | ||
71 | mName = new KLineEdit( generalGroupBox ); | 74 | mName = new KLineEdit( generalGroupBox ); |
72 | 75 | ||
73 | new QLabel("", generalGroupBox ); | 76 | new QLabel("", generalGroupBox ); |
74 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); | 77 | mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); |
75 | mReadOnly->setChecked( mResource->readOnly() ); | 78 | mReadOnly->setChecked( mResource->readOnly() ); |
76 | 79 | ||
77 | new QLabel("", generalGroupBox ); | 80 | new QLabel("", generalGroupBox ); |
78 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); | 81 | mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); |
79 | mIncludeInSync->setChecked( mResource->includeInSync() ); | 82 | mIncludeInSync->setChecked( mResource->includeInSync() ); |
80 | 83 | ||
81 | mName->setText( mResource->resourceName() ); | 84 | mName->setText( mResource->resourceName() ); |
82 | 85 | ||
83 | mainLayout->addWidget( generalGroupBox ); | 86 | mainLayout->addWidget( generalGroupBox ); |
84 | 87 | ||
85 | QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 88 | Q3GroupBox *resourceGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
86 | resourceGroupBox->layout()->setSpacing( spacingHint()); | 89 | resourceGroupBox->layout()->setSpacing( spacingHint()); |
87 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) | 90 | resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) |
88 | .arg( factory->typeName( resource->type() ) ) ); | 91 | .arg( factory->typeName( resource->type() ) ) ); |
89 | mainLayout->addWidget( resourceGroupBox ); | 92 | mainLayout->addWidget( resourceGroupBox ); |
90 | 93 | ||
91 | mainLayout->addStretch(); | 94 | mainLayout->addStretch(); |
92 | 95 | ||
93 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); | 96 | mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); |
94 | if ( mConfigWidget ) { | 97 | if ( mConfigWidget ) { |
95 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), | 98 | connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), |
96 | SLOT( setReadOnly( bool ) ) ); | 99 | SLOT( setReadOnly( bool ) ) ); |
97 | connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), | 100 | connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), |
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 | |||
@@ -19,62 +19,66 @@ | |||
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 | } |
@@ -88,31 +92,31 @@ class ConfigViewItem : public QCheckListItem | |||
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 ); |
@@ -136,39 +140,39 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) | |||
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() |
@@ -221,25 +225,25 @@ void ConfigPage::load() | |||
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 | { |
@@ -332,50 +336,50 @@ void ConfigPage::slotAdd() | |||
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 | ||
@@ -384,25 +388,25 @@ void ConfigPage::slotRemove() | |||
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 | ||
@@ -426,25 +430,25 @@ void ConfigPage::slotStandard() | |||
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 | } |
@@ -473,47 +477,47 @@ void ConfigPage::resourceAdded( Resource* resource ) | |||
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() ); |
diff --git a/microkde/kresources/configpage.h b/microkde/kresources/configpage.h index be9239e..dc1aa50 100644 --- a/microkde/kresources/configpage.h +++ b/microkde/kresources/configpage.h | |||
@@ -16,31 +16,33 @@ | |||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | #ifndef KRESOURCES_CONFIGPAGE_H | 23 | #ifndef KRESOURCES_CONFIGPAGE_H |
24 | #define KRESOURCES_CONFIGPAGE_H | 24 | #define KRESOURCES_CONFIGPAGE_H |
25 | 25 | ||
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qwidget.h> | 27 | #include <qwidget.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3ValueList> | ||
28 | 30 | ||
29 | #include "manager.h" | 31 | #include "manager.h" |
30 | 32 | ||
31 | class KComboBox; | 33 | class KComboBox; |
32 | class KListView; | 34 | class KListView; |
33 | 35 | ||
34 | class QListViewItem; | 36 | class Q3ListViewItem; |
35 | class QPushButton; | 37 | class QPushButton; |
36 | 38 | ||
37 | 39 | ||
38 | namespace KRES { | 40 | namespace KRES { |
39 | 41 | ||
40 | class ResourcePageInfo | 42 | class ResourcePageInfo |
41 | { | 43 | { |
42 | public: | 44 | public: |
43 | Manager<Resource> *mManager; | 45 | Manager<Resource> *mManager; |
44 | KConfig *mConfig; | 46 | KConfig *mConfig; |
45 | }; | 47 | }; |
46 | 48 | ||
@@ -64,41 +66,41 @@ class ConfigPage : public QWidget, public ManagerListener<Resource> | |||
64 | void slotRemove(); | 66 | void slotRemove(); |
65 | void slotEdit(); | 67 | void slotEdit(); |
66 | void slotStandard(); | 68 | void slotStandard(); |
67 | void slotSelectionChanged(); | 69 | void slotSelectionChanged(); |
68 | 70 | ||
69 | // From ManagerListener<Resource> | 71 | // From ManagerListener<Resource> |
70 | public: | 72 | public: |
71 | virtual void resourceAdded( Resource* resource ); | 73 | virtual void resourceAdded( Resource* resource ); |
72 | virtual void resourceModified( Resource* resource ); | 74 | virtual void resourceModified( Resource* resource ); |
73 | virtual void resourceDeleted( Resource* resource ); | 75 | virtual void resourceDeleted( Resource* resource ); |
74 | 76 | ||
75 | protected slots: | 77 | protected slots: |
76 | void slotItemClicked( QListViewItem * ); | 78 | void slotItemClicked( Q3ListViewItem * ); |
77 | 79 | ||
78 | signals: | 80 | signals: |
79 | void changed( bool ); | 81 | void changed( bool ); |
80 | 82 | ||
81 | private: | 83 | private: |
82 | void saveResourceSettings(); | 84 | void saveResourceSettings(); |
83 | 85 | ||
84 | Manager<Resource>* mCurrentManager; | 86 | Manager<Resource>* mCurrentManager; |
85 | KConfig* mCurrentConfig; | 87 | KConfig* mCurrentConfig; |
86 | KConfig* mConfig; | 88 | KConfig* mConfig; |
87 | QString mFamily; | 89 | QString mFamily; |
88 | QStringList mFamilyMap; | 90 | QStringList mFamilyMap; |
89 | QValueList<ResourcePageInfo> mInfoMap; | 91 | Q3ValueList<ResourcePageInfo> mInfoMap; |
90 | 92 | ||
91 | KComboBox* mFamilyCombo; | 93 | KComboBox* mFamilyCombo; |
92 | KListView* mListView; | 94 | KListView* mListView; |
93 | QPushButton* mAddButton; | 95 | QPushButton* mAddButton; |
94 | QPushButton* mRemoveButton; | 96 | QPushButton* mRemoveButton; |
95 | QPushButton* mEditButton; | 97 | QPushButton* mEditButton; |
96 | QPushButton* mStandardButton; | 98 | QPushButton* mStandardButton; |
97 | 99 | ||
98 | QListViewItem* mLastItem; | 100 | Q3ListViewItem* mLastItem; |
99 | static const QString syncfamily; | 101 | static const QString syncfamily; |
100 | }; | 102 | }; |
101 | 103 | ||
102 | } | 104 | } |
103 | 105 | ||
104 | #endif | 106 | #endif |
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp index 86b22b2..4f286d1 100644 --- a/microkde/kresources/factory.cpp +++ b/microkde/kresources/factory.cpp | |||
@@ -32,35 +32,35 @@ | |||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | 33 | ||
34 | #include "resource.h" | 34 | #include "resource.h" |
35 | #include "factory.h" | 35 | #include "factory.h" |
36 | 36 | ||
37 | #ifdef STATIC_RESOURCES | 37 | #ifdef STATIC_RESOURCES |
38 | #include <file/resourcefile.h> | 38 | #include <file/resourcefile.h> |
39 | #include <dir/resourcedir.h> | 39 | #include <dir/resourcedir.h> |
40 | #include <qtopia/resourceqtopia.h> | 40 | #include <qtopia/resourceqtopia.h> |
41 | #endif | 41 | #endif |
42 | using namespace KRES; | 42 | using namespace KRES; |
43 | 43 | ||
44 | QDict<Factory> *Factory::mSelves = 0; | 44 | Q3Dict<Factory> *Factory::mSelves = 0; |
45 | static KStaticDeleter< QDict<Factory> > staticDeleter; | 45 | static KStaticDeleter< Q3Dict<Factory> > staticDeleter; |
46 | 46 | ||
47 | Factory *Factory::self( const QString& resourceFamily) | 47 | Factory *Factory::self( const QString& resourceFamily) |
48 | { | 48 | { |
49 | 49 | ||
50 | 50 | ||
51 | Factory *factory = 0; | 51 | Factory *factory = 0; |
52 | if ( !mSelves ) | 52 | if ( !mSelves ) |
53 | { | 53 | { |
54 | mSelves = staticDeleter.setObject( new QDict<Factory> ); | 54 | mSelves = staticDeleter.setObject( new Q3Dict<Factory> ); |
55 | } | 55 | } |
56 | 56 | ||
57 | factory = mSelves->find( resourceFamily ); | 57 | factory = mSelves->find( resourceFamily ); |
58 | 58 | ||
59 | if ( !factory ) { | 59 | if ( !factory ) { |
60 | factory = new Factory( resourceFamily); | 60 | factory = new Factory( resourceFamily); |
61 | mSelves->insert( resourceFamily, factory ); | 61 | mSelves->insert( resourceFamily, factory ); |
62 | } | 62 | } |
63 | 63 | ||
64 | return factory; | 64 | return factory; |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h index ea01b23..709fde0 100644 --- a/microkde/kresources/factory.h +++ b/microkde/kresources/factory.h | |||
@@ -15,25 +15,25 @@ | |||
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 | #ifndef KRESOURCES_FACTORY_H | 24 | #ifndef KRESOURCES_FACTORY_H |
25 | #define KRESOURCES_FACTORY_H | 25 | #define KRESOURCES_FACTORY_H |
26 | 26 | ||
27 | #include <qdict.h> | 27 | #include <q3dict.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | 29 | ||
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | 34 | ||
35 | namespace KRES { | 35 | namespace KRES { |
36 | 36 | ||
37 | class ConfigWidget; | 37 | class ConfigWidget; |
38 | 38 | ||
39 | //US | 39 | //US |
@@ -105,22 +105,22 @@ class Factory | |||
105 | */ | 105 | */ |
106 | QString typeName( const QString &type ) const; | 106 | QString typeName( const QString &type ) const; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Returns the description for a special type. | 109 | * Returns the description for a special type. |
110 | */ | 110 | */ |
111 | QString typeDescription( const QString &type ) const; | 111 | QString typeDescription( const QString &type ) const; |
112 | 112 | ||
113 | protected: | 113 | protected: |
114 | Factory( const QString& resourceFamily); | 114 | Factory( const QString& resourceFamily); |
115 | 115 | ||
116 | private: | 116 | private: |
117 | static QDict<Factory> *mSelves; | 117 | static Q3Dict<Factory> *mSelves; |
118 | 118 | ||
119 | QString mResourceFamily; | 119 | QString mResourceFamily; |
120 | //US QMap<QString, KService::Ptr> mTypeMap; | 120 | //US QMap<QString, KService::Ptr> mTypeMap; |
121 | //US lets store the pluginfo struct as value instead of a KService | 121 | //US lets store the pluginfo struct as value instead of a KService |
122 | QMap<QString, PluginInfo*> mTypeMap; | 122 | QMap<QString, PluginInfo*> mTypeMap; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | } | 125 | } |
126 | #endif | 126 | #endif |
diff --git a/microkde/kresources/kcmkresources.cpp b/microkde/kresources/kcmkresources.cpp index d600a31..f5eb826 100644 --- a/microkde/kresources/kcmkresources.cpp +++ b/microkde/kresources/kcmkresources.cpp | |||
@@ -11,47 +11,50 @@ | |||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | //Added by qt3to4: | ||
24 | #include <Q3VBoxLayout> | ||
25 | #include <Q3Frame> | ||
23 | 26 | ||
24 | //US #include <kaboutdata.h> | 27 | //US #include <kaboutdata.h> |
25 | //US #include <kgenericfactory.h> | 28 | //US #include <kgenericfactory.h> |
26 | #include <klocale.h> | 29 | #include <klocale.h> |
27 | 30 | ||
28 | #include "configpage.h" | 31 | #include "configpage.h" |
29 | 32 | ||
30 | #include "kcmkresources.h" | 33 | #include "kcmkresources.h" |
31 | 34 | ||
32 | using namespace KRES; | 35 | using namespace KRES; |
33 | 36 | ||
34 | //US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory; | 37 | //US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory; |
35 | //US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) ); | 38 | //US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) ); |
36 | 39 | ||
37 | //US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) | 40 | //US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) |
38 | //US : KCModule( ResourcesFactory::instance(), parent, name ) | 41 | //US : KCModule( ResourcesFactory::instance(), parent, name ) |
39 | KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) | 42 | KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) |
40 | : KDialogBase( parent, name, true, i18n( "Configure Resources" ), | 43 | : KDialogBase( parent, name, true, i18n( "Configure Resources" ), |
41 | Ok|Cancel, Ok, true ) | 44 | Ok|Cancel, Ok, true ) |
42 | { | 45 | { |
43 | QFrame *main = plainPage(); | 46 | Q3Frame *main = plainPage(); |
44 | 47 | ||
45 | QVBoxLayout *layout = new QVBoxLayout( main ); | 48 | Q3VBoxLayout *layout = new Q3VBoxLayout( main ); |
46 | mConfigPage = new KRES::ConfigPage( main ); | 49 | mConfigPage = new KRES::ConfigPage( main ); |
47 | layout->addWidget( mConfigPage ); | 50 | layout->addWidget( mConfigPage ); |
48 | 51 | ||
49 | 52 | ||
50 | connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) ); | 53 | connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) ); |
51 | #ifndef DESKTOP_VERSION | 54 | #ifndef DESKTOP_VERSION |
52 | showMaximized(); | 55 | showMaximized(); |
53 | #endif | 56 | #endif |
54 | } | 57 | } |
55 | 58 | ||
56 | void KCMKResources::changed( bool changed) | 59 | void KCMKResources::changed( bool changed) |
57 | { | 60 | { |
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index 69062da..88705d4 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h | |||
@@ -23,26 +23,28 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef KRESOURCES_MANAGER_H | 32 | #ifndef KRESOURCES_MANAGER_H |
33 | #define KRESOURCES_MANAGER_H | 33 | #define KRESOURCES_MANAGER_H |
34 | 34 | ||
35 | #include <qdict.h> | 35 | #include <q3dict.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | //Added by qt3to4: | ||
38 | #include <Q3PtrList> | ||
37 | 39 | ||
38 | #include "factory.h" | 40 | #include "factory.h" |
39 | #include "managerimpl.h" | 41 | #include "managerimpl.h" |
40 | 42 | ||
41 | namespace KRES { | 43 | namespace KRES { |
42 | 44 | ||
43 | class Resource; | 45 | class Resource; |
44 | 46 | ||
45 | template<class T> | 47 | template<class T> |
46 | class ManagerListener | 48 | class ManagerListener |
47 | { | 49 | { |
48 | public: | 50 | public: |
@@ -166,25 +168,25 @@ class Manager : private ManagerImplListener | |||
166 | } | 168 | } |
167 | 169 | ||
168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } | 170 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } |
169 | 171 | ||
170 | Manager( const QString &family ) | 172 | Manager( const QString &family ) |
171 | { | 173 | { |
172 | mFactory = Factory::self( family ); | 174 | mFactory = Factory::self( family ); |
173 | // The managerimpl will use the same Factory object as the manager | 175 | // The managerimpl will use the same Factory object as the manager |
174 | // because of the Factory::self() pattern | 176 | // because of the Factory::self() pattern |
175 | mImpl = new ManagerImpl( family ); | 177 | mImpl = new ManagerImpl( family ); |
176 | mImpl->setListener( this ); | 178 | mImpl->setListener( this ); |
177 | 179 | ||
178 | mListeners = new QPtrList<ManagerListener<T> >; | 180 | mListeners = new Q3PtrList<ManagerListener<T> >; |
179 | } | 181 | } |
180 | 182 | ||
181 | virtual ~Manager() | 183 | virtual ~Manager() |
182 | { | 184 | { |
183 | mImpl->setListener( 0 ); | 185 | mImpl->setListener( 0 ); |
184 | delete mListeners; | 186 | delete mListeners; |
185 | delete mImpl; | 187 | delete mImpl; |
186 | } | 188 | } |
187 | 189 | ||
188 | /** | 190 | /** |
189 | Recreate Resource objects from configuration file. If cfg is 0, read standard | 191 | Recreate Resource objects from configuration file. If cfg is 0, read standard |
190 | configuration file. | 192 | configuration file. |
@@ -321,18 +323,18 @@ class Manager : private ManagerImplListener | |||
321 | { | 323 | { |
322 | 324 | ||
323 | T* resource = (T *)( res ); | 325 | T* resource = (T *)( res ); |
324 | ManagerListener<T> *listener; | 326 | ManagerListener<T> *listener; |
325 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { | 327 | for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { |
326 | listener->resourceDeleted( resource ); | 328 | listener->resourceDeleted( resource ); |
327 | } | 329 | } |
328 | } | 330 | } |
329 | 331 | ||
330 | private: | 332 | private: |
331 | ManagerImpl *mImpl; | 333 | ManagerImpl *mImpl; |
332 | Factory *mFactory; | 334 | Factory *mFactory; |
333 | QPtrList<ManagerListener<T> > *mListeners; | 335 | Q3PtrList<ManagerListener<T> > *mListeners; |
334 | }; | 336 | }; |
335 | 337 | ||
336 | } | 338 | } |
337 | 339 | ||
338 | #endif | 340 | #endif |
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index a6d2007..4c0751c 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -26,24 +26,26 @@ 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 <kglobal.h> | 31 | #include <kglobal.h> |
32 | 32 | ||
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | //Added by qt3to4: | ||
39 | #include <Q3PtrList> | ||
38 | 40 | ||
39 | #include "resource.h" | 41 | #include "resource.h" |
40 | #include "factory.h" | 42 | #include "factory.h" |
41 | #include "managerimpl.h" | 43 | #include "managerimpl.h" |
42 | 44 | ||
43 | 45 | ||
44 | 46 | ||
45 | using namespace KRES; | 47 | using namespace KRES; |
46 | 48 | ||
47 | ManagerImpl::ManagerImpl( const QString &family ) | 49 | ManagerImpl::ManagerImpl( const QString &family ) |
48 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), | 50 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), |
49 | mFactory( 0 ) | 51 | mFactory( 0 ) |
@@ -223,38 +225,38 @@ QStringList ManagerImpl::resourceNames() | |||
223 | Resource::List::ConstIterator it; | 225 | Resource::List::ConstIterator it; |
224 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 226 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
225 | result.append( (*it)->resourceName() ); | 227 | result.append( (*it)->resourceName() ); |
226 | } | 228 | } |
227 | return result; | 229 | return result; |
228 | } | 230 | } |
229 | 231 | ||
230 | Resource::List *ManagerImpl::resourceList() | 232 | Resource::List *ManagerImpl::resourceList() |
231 | { | 233 | { |
232 | return &mResources; | 234 | return &mResources; |
233 | } | 235 | } |
234 | 236 | ||
235 | QPtrList<Resource> ManagerImpl::resources() | 237 | Q3PtrList<Resource> ManagerImpl::resources() |
236 | { | 238 | { |
237 | QPtrList<Resource> result; | 239 | Q3PtrList<Resource> result; |
238 | 240 | ||
239 | Resource::List::ConstIterator it; | 241 | Resource::List::ConstIterator it; |
240 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 242 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
241 | result.append( *it ); | 243 | result.append( *it ); |
242 | } | 244 | } |
243 | return result; | 245 | return result; |
244 | } | 246 | } |
245 | 247 | ||
246 | QPtrList<Resource> ManagerImpl::resources( bool active ) | 248 | Q3PtrList<Resource> ManagerImpl::resources( bool active ) |
247 | { | 249 | { |
248 | QPtrList<Resource> result; | 250 | Q3PtrList<Resource> result; |
249 | 251 | ||
250 | Resource::List::ConstIterator it; | 252 | Resource::List::ConstIterator it; |
251 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 253 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
252 | if ( (*it)->isActive() == active ) { | 254 | if ( (*it)->isActive() == active ) { |
253 | result.append( *it ); | 255 | result.append( *it ); |
254 | } | 256 | } |
255 | } | 257 | } |
256 | return result; | 258 | return result; |
257 | } | 259 | } |
258 | 260 | ||
259 | void ManagerImpl::setListener( ManagerImplListener *listener ) | 261 | void ManagerImpl::setListener( ManagerImplListener *listener ) |
260 | { | 262 | { |
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h index 56a2db6..1f728e5 100644 --- a/microkde/kresources/managerimpl.h +++ b/microkde/kresources/managerimpl.h | |||
@@ -23,26 +23,26 @@ | |||
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 | #ifndef KRESOURCES_MANAGERIMPL_H | 31 | #ifndef KRESOURCES_MANAGERIMPL_H |
32 | #define KRESOURCES_MANAGERIMPL_H | 32 | #define KRESOURCES_MANAGERIMPL_H |
33 | 33 | ||
34 | #include <qstring.h> | 34 | #include <qstring.h> |
35 | #include <qptrlist.h> | 35 | #include <q3ptrlist.h> |
36 | #include <qdict.h> | 36 | #include <q3dict.h> |
37 | //US | 37 | //US |
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | #include "resource.h" | 40 | #include "resource.h" |
41 | 41 | ||
42 | 42 | ||
43 | class KConfig; | 43 | class KConfig; |
44 | 44 | ||
45 | namespace KRES { | 45 | namespace KRES { |
46 | 46 | ||
47 | class Resource; | 47 | class Resource; |
48 | class Factory; | 48 | class Factory; |
@@ -72,28 +72,28 @@ class ManagerImpl : public QObject | |||
72 | void writeConfig( KConfig * ); | 72 | void writeConfig( KConfig * ); |
73 | 73 | ||
74 | void add( Resource *resource, bool useDCOP = true ); | 74 | void add( Resource *resource, bool useDCOP = true ); |
75 | void remove( Resource *resource, bool useDCOP = true ); | 75 | void remove( Resource *resource, bool useDCOP = true ); |
76 | 76 | ||
77 | Resource *standardResource(); | 77 | Resource *standardResource(); |
78 | void setStandardResource( Resource *resource ); | 78 | void setStandardResource( Resource *resource ); |
79 | 79 | ||
80 | void setActive( Resource *resource, bool active ); | 80 | void setActive( Resource *resource, bool active ); |
81 | 81 | ||
82 | Resource::List *resourceList(); | 82 | Resource::List *resourceList(); |
83 | 83 | ||
84 | QPtrList<Resource> resources(); | 84 | Q3PtrList<Resource> resources(); |
85 | 85 | ||
86 | // Get only active or passive resources | 86 | // Get only active or passive resources |
87 | QPtrList<Resource> resources( bool active ); | 87 | Q3PtrList<Resource> resources( bool active ); |
88 | 88 | ||
89 | QStringList resourceNames(); | 89 | QStringList resourceNames(); |
90 | 90 | ||
91 | void setListener( ManagerImplListener *listener ); | 91 | void setListener( ManagerImplListener *listener ); |
92 | 92 | ||
93 | public slots: | 93 | public slots: |
94 | void resourceChanged( Resource *resource ); | 94 | void resourceChanged( Resource *resource ); |
95 | 95 | ||
96 | private: | 96 | private: |
97 | // dcop calls | 97 | // dcop calls |
98 | 98 | ||
99 | private: | 99 | private: |
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h index ed5af96..1f9527c 100644 --- a/microkde/kresources/resource.h +++ b/microkde/kresources/resource.h | |||
@@ -19,25 +19,25 @@ | |||
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef KRESOURCES_RESOURCE_H | 23 | #ifndef KRESOURCES_RESOURCE_H |
24 | #define KRESOURCES_RESOURCE_H | 24 | #define KRESOURCES_RESOURCE_H |
25 | 25 | ||
26 | //US | 26 | //US |
27 | #ifdef QT_THREAD_SUPPORT | 27 | #ifdef QT_THREAD_SUPPORT |
28 | #include <qmutex.h> | 28 | #include <qmutex.h> |
29 | #endif //QT_THREAD_SUPPORT | 29 | #endif //QT_THREAD_SUPPORT |
30 | 30 | ||
31 | #include <qvaluelist.h> | 31 | #include <q3valuelist.h> |
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | 35 | ||
36 | #include <klibloader.h> | 36 | #include <klibloader.h> |
37 | 37 | ||
38 | class KConfig; | 38 | class KConfig; |
39 | 39 | ||
40 | namespace KRES { | 40 | namespace KRES { |
41 | 41 | ||
42 | class ConfigWidget; | 42 | class ConfigWidget; |
43 | 43 | ||
@@ -230,25 +230,25 @@ link_DATA= resourceexample.desktop | |||
230 | /** | 230 | /** |
231 | * A @ref Resource is a ... | 231 | * A @ref Resource is a ... |
232 | * | 232 | * |
233 | * A subclass should reimplement at least the constructor and the | 233 | * A subclass should reimplement at least the constructor and the |
234 | k * @ref writeConfig method. | 234 | k * @ref writeConfig method. |
235 | * | 235 | * |
236 | */ | 236 | */ |
237 | class Resource : public QObject | 237 | class Resource : public QObject |
238 | { | 238 | { |
239 | Q_OBJECT | 239 | Q_OBJECT |
240 | 240 | ||
241 | public: | 241 | public: |
242 | typedef QValueList<Resource *> List; | 242 | typedef Q3ValueList<Resource *> List; |
243 | 243 | ||
244 | /** | 244 | /** |
245 | * Constructor. Construct resource from config. | 245 | * Constructor. Construct resource from config. |
246 | * @param config Configuration to read persistence information from. | 246 | * @param config Configuration to read persistence information from. |
247 | * If config==0, create object using default settings. | 247 | * If config==0, create object using default settings. |
248 | */ | 248 | */ |
249 | Resource( const KConfig* config ); | 249 | Resource( const KConfig* config ); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Destructor. | 252 | * Destructor. |
253 | */ | 253 | */ |
254 | virtual ~Resource(); | 254 | virtual ~Resource(); |
diff --git a/microkde/kresources/selectdialog.cpp b/microkde/kresources/selectdialog.cpp index fba8648..d5b83e9 100644 --- a/microkde/kresources/selectdialog.cpp +++ b/microkde/kresources/selectdialog.cpp | |||
@@ -25,64 +25,68 @@ | |||
25 | #include <kbuttonbox.h> | 25 | #include <kbuttonbox.h> |
26 | #include <klistbox.h> | 26 | #include <klistbox.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kmessagebox.h> | 28 | #include <kmessagebox.h> |
29 | 29 | ||
30 | */ | 30 | */ |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | 33 | ||
34 | //US | 34 | //US |
35 | #include <kglobal.h> | 35 | #include <kglobal.h> |
36 | 36 | ||
37 | #include <qlistbox.h> | 37 | #include <q3listbox.h> |
38 | #include <qlayout.h> | 38 | #include <qlayout.h> |
39 | #include <qgroupbox.h> | 39 | #include <q3groupbox.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3VBoxLayout> | ||
42 | #include <Q3Frame> | ||
43 | #include <Q3PtrList> | ||
40 | 44 | ||
41 | #include "resource.h" | 45 | #include "resource.h" |
42 | 46 | ||
43 | #include "selectdialog.h" | 47 | #include "selectdialog.h" |
44 | 48 | ||
45 | using namespace KRES; | 49 | using namespace KRES; |
46 | 50 | ||
47 | //US I am using KBaseDialog instead of KDialog | 51 | //US I am using KBaseDialog instead of KDialog |
48 | //US : KDialog( parent, name, true ) | 52 | //US : KDialog( parent, name, true ) |
49 | SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, | 53 | SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent, |
50 | const char *name ) | 54 | const char *name ) |
51 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, | 55 | : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, |
52 | Ok, true) | 56 | Ok, true) |
53 | 57 | ||
54 | { | 58 | { |
55 | //US setCaption( i18n( "Resource Selection" ) ); | 59 | //US setCaption( i18n( "Resource Selection" ) ); |
56 | //US resize( 300, 200 ); | 60 | //US resize( 300, 200 ); |
57 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); | 61 | resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); |
58 | 62 | ||
59 | //US | 63 | //US |
60 | QFrame *main = plainPage(); | 64 | Q3Frame *main = plainPage(); |
61 | /*US | 65 | /*US |
62 | QVBoxLayout *layout = new QVBoxLayout( main ); | 66 | QVBoxLayout *layout = new QVBoxLayout( main ); |
63 | mConfigPage = new KRES::ConfigPage( main ); | 67 | mConfigPage = new KRES::ConfigPage( main ); |
64 | layout->addWidget( mConfigPage ); | 68 | layout->addWidget( mConfigPage ); |
65 | */ | 69 | */ |
66 | 70 | ||
67 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); | 71 | //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); |
68 | QVBoxLayout *mainLayout = new QVBoxLayout( main ); | 72 | Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main ); |
69 | mainLayout->setMargin( marginHint() ); | 73 | mainLayout->setMargin( marginHint() ); |
70 | 74 | ||
71 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); | 75 | //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); |
72 | QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main ); | 76 | Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); |
73 | groupBox->setTitle( i18n( "Resources" ) ); | 77 | groupBox->setTitle( i18n( "Resources" ) ); |
74 | 78 | ||
75 | //US mResourceId = new KListBox( groupBox ); | 79 | //US mResourceId = new KListBox( groupBox ); |
76 | mResourceId = new QListBox( groupBox ); | 80 | mResourceId = new Q3ListBox( groupBox ); |
77 | 81 | ||
78 | mainLayout->addWidget( groupBox ); | 82 | mainLayout->addWidget( groupBox ); |
79 | 83 | ||
80 | mainLayout->addSpacing( 40 ); | 84 | mainLayout->addSpacing( 40 ); |
81 | 85 | ||
82 | /*US | 86 | /*US |
83 | KButtonBox *buttonBox = new KButtonBox( this ); | 87 | KButtonBox *buttonBox = new KButtonBox( this ); |
84 | 88 | ||
85 | buttonBox->addStretch(); | 89 | buttonBox->addStretch(); |
86 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); | 90 | buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); |
87 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); | 91 | buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); |
88 | buttonBox->layout(); | 92 | buttonBox->layout(); |
@@ -92,37 +96,37 @@ SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, | |||
92 | // setup listbox | 96 | // setup listbox |
93 | uint counter = 0; | 97 | uint counter = 0; |
94 | for ( uint i = 0; i < list.count(); ++i ) { | 98 | for ( uint i = 0; i < list.count(); ++i ) { |
95 | Resource *resource = list.at( i ); | 99 | Resource *resource = list.at( i ); |
96 | if ( resource && !resource->readOnly() ) { | 100 | if ( resource && !resource->readOnly() ) { |
97 | mResourceMap.insert( counter, resource ); | 101 | mResourceMap.insert( counter, resource ); |
98 | mResourceId->insertItem( resource->resourceName() ); | 102 | mResourceId->insertItem( resource->resourceName() ); |
99 | counter++; | 103 | counter++; |
100 | } | 104 | } |
101 | } | 105 | } |
102 | 106 | ||
103 | mResourceId->setCurrentItem( 0 ); | 107 | mResourceId->setCurrentItem( 0 ); |
104 | connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)), | 108 | connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)), |
105 | SLOT(accept()) ); | 109 | SLOT(accept()) ); |
106 | } | 110 | } |
107 | 111 | ||
108 | Resource *SelectDialog::resource() | 112 | Resource *SelectDialog::resource() |
109 | { | 113 | { |
110 | if ( mResourceId->currentItem() != -1 ) | 114 | if ( mResourceId->currentItem() != -1 ) |
111 | return mResourceMap[ mResourceId->currentItem() ]; | 115 | return mResourceMap[ mResourceId->currentItem() ]; |
112 | else | 116 | else |
113 | return 0; | 117 | return 0; |
114 | } | 118 | } |
115 | 119 | ||
116 | Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent ) | 120 | Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent ) |
117 | { | 121 | { |
118 | if ( list.count() == 0 ) { | 122 | if ( list.count() == 0 ) { |
119 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); | 123 | KMessageBox::error( parent, i18n( "There is no resource available!" ) ); |
120 | return 0; | 124 | return 0; |
121 | } | 125 | } |
122 | 126 | ||
123 | if ( list.count() == 1 ) return list.first(); | 127 | if ( list.count() == 1 ) return list.first(); |
124 | 128 | ||
125 | // the following lines will return a writeable resource if only _one_ writeable | 129 | // the following lines will return a writeable resource if only _one_ writeable |
126 | // resource exists | 130 | // resource exists |
127 | Resource *found = 0; | 131 | Resource *found = 0; |
128 | Resource *it = list.first(); | 132 | Resource *it = list.first(); |
diff --git a/microkde/kresources/selectdialog.h b/microkde/kresources/selectdialog.h index 7026212..be5152b 100644 --- a/microkde/kresources/selectdialog.h +++ b/microkde/kresources/selectdialog.h | |||
@@ -16,31 +16,31 @@ | |||
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 | #ifndef KRESOURCES_SELECTDIALOG_H | 24 | #ifndef KRESOURCES_SELECTDIALOG_H |
25 | #define KRESOURCES_SELECTDIALOG_H | 25 | #define KRESOURCES_SELECTDIALOG_H |
26 | 26 | ||
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | #include <qmap.h> | 29 | #include <qmap.h> |
30 | 30 | ||
31 | #include <kdialogbase.h> | 31 | #include <kdialogbase.h> |
32 | 32 | ||
33 | //US class KListBox; | 33 | //US class KListBox; |
34 | class QListBox; | 34 | class Q3ListBox; |
35 | 35 | ||
36 | namespace KRES { | 36 | namespace KRES { |
37 | 37 | ||
38 | class Resource; | 38 | class Resource; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Dialog for selecting a resource. | 41 | * Dialog for selecting a resource. |
42 | * | 42 | * |
43 | * Example: | 43 | * Example: |
44 | * | 44 | * |
45 | * <pre> | 45 | * <pre> |
46 | * KABC::Resource *res = KABC::SelectDialog::getResource(); | 46 | * KABC::Resource *res = KABC::SelectDialog::getResource(); |
@@ -53,40 +53,40 @@ class Resource; | |||
53 | */ | 53 | */ |
54 | //US class SelectDialog : KDialog | 54 | //US class SelectDialog : KDialog |
55 | class SelectDialog : KDialogBase | 55 | class SelectDialog : KDialogBase |
56 | { | 56 | { |
57 | // Q_OBJECT | 57 | // Q_OBJECT |
58 | public: | 58 | public: |
59 | /** | 59 | /** |
60 | * Constructor. | 60 | * Constructor. |
61 | * @param ab The address book you want to select the resource from | 61 | * @param ab The address book you want to select the resource from |
62 | * @param parent The parent widget | 62 | * @param parent The parent widget |
63 | * @param name The name of the dialog | 63 | * @param name The name of the dialog |
64 | */ | 64 | */ |
65 | SelectDialog( QPtrList<Resource> list, QWidget *parent = 0, | 65 | SelectDialog( Q3PtrList<Resource> list, QWidget *parent = 0, |
66 | const char *name = 0); | 66 | const char *name = 0); |
67 | 67 | ||
68 | // ~SelectDialog(); | 68 | // ~SelectDialog(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Return selected resource. | 71 | * Return selected resource. |
72 | */ | 72 | */ |
73 | Resource *resource(); | 73 | Resource *resource(); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Open a dialog showing the available resources and return the resource the | 76 | * Open a dialog showing the available resources and return the resource the |
77 | * user has selected. Returns 0, if the dialog was canceled. | 77 | * user has selected. Returns 0, if the dialog was canceled. |
78 | */ | 78 | */ |
79 | static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 ); | 79 | static Resource *getResource( Q3PtrList<Resource> list, QWidget *parent = 0 ); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | //US KListBox *mResourceId; | 82 | //US KListBox *mResourceId; |
83 | QListBox *mResourceId; | 83 | Q3ListBox *mResourceId; |
84 | 84 | ||
85 | QMap<int, Resource*> mResourceMap; | 85 | QMap<int, Resource*> mResourceMap; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | } | 90 | } |
91 | 91 | ||
92 | #endif | 92 | #endif |