summaryrefslogtreecommitdiffabout
path: root/microkde/kresources
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kresources
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kresources') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/configdialog.cpp17
-rw-r--r--microkde/kresources/configpage.cpp38
-rw-r--r--microkde/kresources/configpage.h10
-rw-r--r--microkde/kresources/factory.cpp6
-rw-r--r--microkde/kresources/factory.h4
-rw-r--r--microkde/kresources/kcmkresources.cpp7
-rw-r--r--microkde/kresources/manager.h8
-rw-r--r--microkde/kresources/managerimpl.cpp10
-rw-r--r--microkde/kresources/managerimpl.h8
-rw-r--r--microkde/kresources/resource.h4
-rw-r--r--microkde/kresources/selectdialog.cpp22
-rw-r--r--microkde/kresources/selectdialog.h10
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
@@ -4,106 +4,109 @@
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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#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
45using namespace KRES; 48using namespace KRES;
46 49
47ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, 50ConfigDialog::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 ) ),
98 SLOT( setIncludeInSync( bool ) ) ); 101 SLOT( setIncludeInSync( bool ) ) );
99 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), 102 connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
100 SLOT( setPersistentReadOnly( bool ) ) ); 103 SLOT( setPersistentReadOnly( bool ) ) );
101 mConfigWidget->setInEditMode( false ); 104 mConfigWidget->setInEditMode( false );
102 mConfigWidget->loadSettings( mResource ); 105 mConfigWidget->loadSettings( mResource );
103 mConfigWidget->show(); 106 mConfigWidget->show();
104 107
105 } 108 }
106 109
107 110
108 connect( mName, SIGNAL( textChanged(const QString &)), 111 connect( mName, SIGNAL( textChanged(const QString &)),
109 SLOT( slotNameChanged(const QString &))); 112 SLOT( slotNameChanged(const QString &)));
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
@@ -7,180 +7,184 @@
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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
62using namespace KRES; 66using namespace KRES;
63 67
64class ConfigViewItem : public QCheckListItem 68class 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
93ConfigPage::ConfigPage( QWidget *parent, const char *name ) 97ConfigPage::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 );
123 groupBoxLayout->addWidget( mAddButton, 2, 0 ); 127 groupBoxLayout->addWidget( mAddButton, 2, 0 );
124 mRemoveButton = new QPushButton( i18n( "&Remove" ), groupBox ); 128 mRemoveButton = new QPushButton( i18n( "&Remove" ), groupBox );
125 groupBoxLayout->addWidget( mRemoveButton, 2, 1 ); 129 groupBoxLayout->addWidget( mRemoveButton, 2, 1 );
126 mEditButton = new QPushButton( i18n( "&Edit..." ), groupBox ); 130 mEditButton = new QPushButton( i18n( "&Edit..." ), groupBox );
127 groupBoxLayout->addWidget( mEditButton, 3, 0 ); 131 groupBoxLayout->addWidget( mEditButton, 3, 0 );
128 mStandardButton = new QPushButton( i18n( "&Use as Standard" ), groupBox ); 132 mStandardButton = new QPushButton( i18n( "&Use as Standard" ), groupBox );
129 groupBoxLayout->addWidget( mStandardButton, 3, 1 ); 133 groupBoxLayout->addWidget( mStandardButton, 3, 1 );
130 134
131 mRemoveButton->setEnabled( false ); 135 mRemoveButton->setEnabled( false );
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
160ConfigPage::~ConfigPage() 164ConfigPage::~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
174void ConfigPage::load() 178void ConfigPage::load()
175{ 179{
176 kdDebug(5650) << "ConfigPage::load()" << endl; 180 kdDebug(5650) << "ConfigPage::load()" << endl;
177 181
178 mListView->clear(); 182 mListView->clear();
179 183
180//US we remove the dynamic pluginloader, and set the one family we need (contact) manually. 184//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
181 185
182//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" ); 186//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
183//US KTrader::OfferList::ConstIterator it; 187//US KTrader::OfferList::ConstIterator it;
184//US for ( it = plugins.begin(); it != plugins.end(); ++it ) { 188//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
185//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" ); 189//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
186//US QString family = tmp.toString(); 190//US QString family = tmp.toString();
@@ -209,49 +213,49 @@ void ConfigPage::load()
209 } else { 213 } else {
210 QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) ); 214 QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
211 info.mConfig = new KConfig( configFile ); 215 info.mConfig = new KConfig( configFile );
212 } 216 }
213 info.mManager->readConfig( info.mConfig ); 217 info.mManager->readConfig( info.mConfig );
214 218
215 mInfoMap.append( info ); 219 mInfoMap.append( info );
216 } 220 }
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
229void ConfigPage::save() 233void 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
240void ConfigPage::defaults() 244void ConfigPage::defaults()
241{ 245{
242} 246}
243 247
244void ConfigPage::slotFamilyChanged( int pos ) 248void 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();
250 254
251 mFamily = mFamilyMap[ pos ]; 255 mFamily = mFamilyMap[ pos ];
252 256
253//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1()); 257//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1());
254 258
255 mCurrentManager = mInfoMap[ pos ].mManager; 259 mCurrentManager = mInfoMap[ pos ].mManager;
256 mCurrentConfig = mInfoMap[ pos ].mConfig; 260 mCurrentConfig = mInfoMap[ pos ].mConfig;
257 261
@@ -320,212 +324,212 @@ void ConfigPage::slotAdd()
320 324
321 // Create new resource 325 // Create new resource
322 Resource *resource = mCurrentManager->createResource( type ); 326 Resource *resource = mCurrentManager->createResource( type );
323 if ( !resource ) { 327 if ( !resource ) {
324 KMessageBox::error( this, i18n("Unable to create resource of type '%1'.") 328 KMessageBox::error( this, i18n("Unable to create resource of type '%1'.")
325 .arg( type ) ); 329 .arg( type ) );
326 return; 330 return;
327 } 331 }
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
364void ConfigPage::slotRemove() 368void 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
391void ConfigPage::slotEdit() 395void 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 }
413 417
414 mCurrentManager->resourceChanged( resource ); 418 mCurrentManager->resourceChanged( resource );
415 emit changed( true ); 419 emit changed( true );
416 } 420 }
417} 421}
418 422
419void ConfigPage::slotStandard() 423void ConfigPage::slotStandard()
420{ 424{
421 if ( !mCurrentManager ) 425 if ( !mCurrentManager )
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
452void ConfigPage::slotSelectionChanged() 456void ConfigPage::slotSelectionChanged()
453{ 457{
454 bool state = ( mListView->currentItem() != 0 ); 458 bool state = ( mListView->currentItem() != 0 );
455 459
456 mRemoveButton->setEnabled( state ); 460 mRemoveButton->setEnabled( state );
457 mEditButton->setEnabled( state ); 461 mEditButton->setEnabled( state );
458 mStandardButton->setEnabled( state ); 462 mStandardButton->setEnabled( state );
459} 463}
460 464
461void ConfigPage::resourceAdded( Resource* resource ) 465void ConfigPage::resourceAdded( Resource* resource )
462{ 466{
463 qDebug("ConfigPage::resourceAdded : %s", resource->resourceName().latin1()); 467 qDebug("ConfigPage::resourceAdded : %s", resource->resourceName().latin1());
464 ConfigViewItem *item = new ConfigViewItem( mListView, resource ); 468 ConfigViewItem *item = new ConfigViewItem( mListView, resource );
465 469
466 // FIXME: this sucks. This should be in the config file, 470 // FIXME: this sucks. This should be in the config file,
467 // or application-dependent, in which case it's always Off 471 // or application-dependent, in which case it's always Off
468 item->setOn( false ); 472 item->setOn( false );
469 473
470 mLastItem = item; 474 mLastItem = item;
471 475
472 emit changed( true ); 476 emit changed( true );
473} 477}
474 478
475void ConfigPage::resourceModified( Resource* resource ) 479void 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
480void ConfigPage::resourceDeleted( Resource* resource ) 484void 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
485void ConfigPage::slotItemClicked( QListViewItem *item ) 489void 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
501void ConfigPage::saveResourceSettings() 505void 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 );
524 528
525 if ( !mCurrentManager->standardResource() ) 529 if ( !mCurrentManager->standardResource() )
526 KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) ); 530 KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) );
527 } 531 }
528 532
529 //qDebug("ConfigPage::saveResourceSettings() end"); 533 //qDebug("ConfigPage::saveResourceSettings() end");
530 534
531} 535}
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
@@ -4,101 +4,103 @@
4 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 4 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
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 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
31class KComboBox; 33class KComboBox;
32class KListView; 34class KListView;
33 35
34class QListViewItem; 36class Q3ListViewItem;
35class QPushButton; 37class QPushButton;
36 38
37 39
38namespace KRES { 40namespace KRES {
39 41
40class ResourcePageInfo 42class 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
47class Resource; 49class Resource;
48 50
49class ConfigPage : public QWidget, public ManagerListener<Resource> 51class ConfigPage : public QWidget, public ManagerListener<Resource>
50{ 52{
51 Q_OBJECT 53 Q_OBJECT
52 54
53 public: 55 public:
54 ConfigPage( QWidget *parent = 0, const char *name = 0 ); 56 ConfigPage( QWidget *parent = 0, const char *name = 0 );
55 virtual ~ConfigPage(); 57 virtual ~ConfigPage();
56 58
57 void load(); 59 void load();
58 void save(); 60 void save();
59 virtual void defaults(); 61 virtual void defaults();
60 62
61 public slots: 63 public slots:
62 void slotFamilyChanged( int ); 64 void slotFamilyChanged( int );
63 void slotAdd(); 65 void slotAdd();
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
@@ -20,59 +20,59 @@
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 <kdebug.h> 24#include <kdebug.h>
25#include <klocale.h> 25#include <klocale.h>
26#include <ksimpleconfig.h> 26#include <ksimpleconfig.h>
27#include <kstandarddirs.h> 27#include <kstandarddirs.h>
28#include <kstaticdeleter.h> 28#include <kstaticdeleter.h>
29//#ifndef DESKTOP_VERSION 29//#ifndef DESKTOP_VERSION
30#include <klibloader.h> 30#include <klibloader.h>
31//#endif 31//#endif
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
42using namespace KRES; 42using namespace KRES;
43 43
44QDict<Factory> *Factory::mSelves = 0; 44Q3Dict<Factory> *Factory::mSelves = 0;
45static KStaticDeleter< QDict<Factory> > staticDeleter; 45static KStaticDeleter< Q3Dict<Factory> > staticDeleter;
46 46
47Factory *Factory::self( const QString& resourceFamily) 47Factory *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
67Factory::Factory( const QString& resourceFamily) : 67Factory::Factory( const QString& resourceFamily) :
68 mResourceFamily( resourceFamily ) 68 mResourceFamily( resourceFamily )
69{ 69{
70//US so far we have three types available for resourceFamily "contact" 70//US so far we have three types available for resourceFamily "contact"
71// and that are "file", "dir", "ldap" 71// and that are "file", "dir", "ldap"
72/*US 72/*US
73 73
74 KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" ) 74 KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" )
75 .arg( resourceFamily ) ); 75 .arg( resourceFamily ) );
76 KTrader::OfferList::ConstIterator it; 76 KTrader::OfferList::ConstIterator it;
77 for ( it = plugins.begin(); it != plugins.end(); ++it ) { 77 for ( it = plugins.begin(); it != plugins.end(); ++it ) {
78 QVariant type = (*it)->property( "X-KDE-ResourceType" ); 78 QVariant type = (*it)->property( "X-KDE-ResourceType" );
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
@@ -3,49 +3,49 @@
3 3
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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
35namespace KRES { 35namespace KRES {
36 36
37class ConfigWidget; 37class ConfigWidget;
38 38
39//US 39//US
40struct PluginInfo 40struct PluginInfo
41{ 41{
42 QString library; 42 QString library;
43 QString nameLabel; 43 QString nameLabel;
44 QString descriptionLabel; 44 QString descriptionLabel;
45}; 45};
46 46
47 47
48/** 48/**
49 * Class for loading resource plugins. 49 * Class for loading resource plugins.
50 * Do not use this class directly. Use ResourceManager instead 50 * Do not use this class directly. Use ResourceManager instead
51 * 51 *
@@ -93,34 +93,34 @@ class Factory
93 * @param ab The address book, the resource should belong to 93 * @param ab The address book, the resource should belong to
94 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. 94 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
95 */ 95 */
96 Resource *resource( const QString& type, const KConfig *config); 96 Resource *resource( const QString& type, const KConfig *config);
97 97
98 /** 98 /**
99 * Returns a list of all available resource types. 99 * Returns a list of all available resource types.
100 */ 100 */
101 QStringList typeNames() const; 101 QStringList typeNames() const;
102 102
103 /** 103 /**
104 * Returns the name for a special type. 104 * Returns the name for a special type.
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
@@ -1,69 +1,72 @@
1/* 1/*
2 This file is part of libkresources. 2 This file is part of libkresources.
3 3
4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
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
32using namespace KRES; 35using 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 )
39KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) 42KCMKResources::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
56void KCMKResources::changed( bool changed) 59void KCMKResources::changed( bool changed)
57{ 60{
58 modified = changed; 61 modified = changed;
59} 62}
60 63
61void KCMKResources::slotOk() 64void KCMKResources::slotOk()
62{ 65{
63 if (modified) { 66 if (modified) {
64 mConfigPage->save(); 67 mConfigPage->save();
65 modified = false; 68 modified = false;
66 } 69 }
67 70
68 KDialogBase::slotOk(); 71 KDialogBase::slotOk();
69} 72}
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
@@ -11,50 +11,52 @@
11 License as published by the Free Software Foundation; either 11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version. 12 version 2 of the License, or (at your option) any later version.
13 13
14 This library is distributed in the hope that it will be useful, 14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details. 17 Library General Public License for more details.
18 18
19 You should have received a copy of the GNU Library General Public License 19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to 20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. 22 Boston, MA 02111-1307, USA.
23*/ 23*/
24 24
25/* 25/*
26Enhanced Version of the file for platform independent KDE tools. 26Enhanced Version of the file for platform independent KDE tools.
27Copyright (c) 2004 Ulf Schenk 27Copyright (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
41namespace KRES { 43namespace KRES {
42 44
43class Resource; 45class Resource;
44 46
45template<class T> 47template<class T>
46class ManagerListener 48class ManagerListener
47{ 49{
48 public: 50 public:
49 virtual void resourceAdded( T *resource ) = 0; 51 virtual void resourceAdded( T *resource ) = 0;
50 virtual void resourceModified( T *resource ) = 0; 52 virtual void resourceModified( T *resource ) = 0;
51 virtual void resourceDeleted( T *resource ) = 0; 53 virtual void resourceDeleted( T *resource ) = 0;
52}; 54};
53 55
54// TODO: 56// TODO:
55// The resource manager should provide some signals 57// The resource manager should provide some signals
56// to warn applications that resources have been added, 58// to warn applications that resources have been added,
57// removed or modified. 59// removed or modified.
58// 60//
59// The manager should also keep track of which (or at least 61// The manager should also keep track of which (or at least
60// how many) applications hve opened a resource, so that it 62// how many) applications hve opened a resource, so that it
@@ -154,49 +156,49 @@ class Manager : private ManagerImplListener
154 if ( it.mIt != mImpl->resourceList()->end() ) { 156 if ( it.mIt != mImpl->resourceList()->end() ) {
155 if ( !(*it)->isActive() ) it++; 157 if ( !(*it)->isActive() ) it++;
156 } 158 }
157 return it; 159 return it;
158 } 160 }
159 161
160 ActiveIterator activeEnd() 162 ActiveIterator activeEnd()
161 { 163 {
162 ActiveIterator it; 164 ActiveIterator it;
163 it.mIt = mImpl->resourceList()->end(); 165 it.mIt = mImpl->resourceList()->end();
164 it.mList = mImpl->resourceList(); 166 it.mList = mImpl->resourceList();
165 return it; 167 return it;
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.
191 */ 193 */
192 void readConfig( KConfig *cfg = 0 ) 194 void readConfig( KConfig *cfg = 0 )
193 { 195 {
194 mImpl->readConfig( cfg ); 196 mImpl->readConfig( cfg );
195 } 197 }
196 198
197 /** 199 /**
198 Write configuration of Resource objects to configuration file. If cfg is 0, write 200 Write configuration of Resource objects to configuration file. If cfg is 0, write
199 to standard configuration file. 201 to standard configuration file.
200 */ 202 */
201 void writeConfig( KConfig *cfg = 0 ) 203 void writeConfig( KConfig *cfg = 0 )
202 { 204 {
@@ -309,30 +311,30 @@ class Manager : private ManagerImplListener
309 } 311 }
310 312
311 virtual void resourceModified( Resource *res ) 313 virtual void resourceModified( Resource *res )
312 { 314 {
313 315
314 T* resource = (T *)( res ); 316 T* resource = (T *)( res );
315 ManagerListener<T> *listener; 317 ManagerListener<T> *listener;
316 for ( listener = mListeners->first(); listener; listener = mListeners->next() ) 318 for ( listener = mListeners->first(); listener; listener = mListeners->next() )
317 listener->resourceModified( resource ); 319 listener->resourceModified( resource );
318 } 320 }
319 321
320 virtual void resourceDeleted( Resource *res ) 322 virtual void resourceDeleted( Resource *res )
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
@@ -14,48 +14,50 @@
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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
45using namespace KRES; 47using namespace KRES;
46 48
47ManagerImpl::ManagerImpl( const QString &family ) 49ManagerImpl::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 )
50 52
51{ 53{
52 kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; 54 kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
53 55
54 56
55} 57}
56 58
57ManagerImpl::~ManagerImpl() 59ManagerImpl::~ManagerImpl()
58{ 60{
59 kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; 61 kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
60 62
61 Resource::List::ConstIterator it; 63 Resource::List::ConstIterator it;
@@ -211,62 +213,62 @@ void ManagerImpl::resourceChanged( Resource *resource )
211 213
212// ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); 214// ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() );
213// allManagers.dcopResourceModified( resource->identifier() ); 215// allManagers.dcopResourceModified( resource->identifier() );
214} 216}
215 217
216// DCOP asynchronous functions 218// DCOP asynchronous functions
217//US since we work from inside the application, we call the methods directly. 219//US since we work from inside the application, we call the methods directly.
218 220
219QStringList ManagerImpl::resourceNames() 221QStringList ManagerImpl::resourceNames()
220{ 222{
221 QStringList result; 223 QStringList result;
222 224
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
230Resource::List *ManagerImpl::resourceList() 232Resource::List *ManagerImpl::resourceList()
231{ 233{
232 return &mResources; 234 return &mResources;
233} 235}
234 236
235QPtrList<Resource> ManagerImpl::resources() 237Q3PtrList<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
246QPtrList<Resource> ManagerImpl::resources( bool active ) 248Q3PtrList<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
259void ManagerImpl::setListener( ManagerImplListener *listener ) 261void ManagerImpl::setListener( ManagerImplListener *listener )
260{ 262{
261 mListener = listener; 263 mListener = listener;
262} 264}
263 265
264Resource* ManagerImpl::readResourceConfig( const QString& identifier, 266Resource* ManagerImpl::readResourceConfig( const QString& identifier,
265 bool checkActive ) 267 bool checkActive )
266{ 268{
267 kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; 269 kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
268 270
269// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); 271// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
270 272
271 mConfig->setGroup( "Resource_" + identifier ); 273 mConfig->setGroup( "Resource_" + identifier );
272#ifdef _WIN32_ 274#ifdef _WIN32_
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
@@ -11,101 +11,101 @@
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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
43class KConfig; 43class KConfig;
44 44
45namespace KRES { 45namespace KRES {
46 46
47class Resource; 47class Resource;
48class Factory; 48class Factory;
49 49
50class ManagerImplListener 50class ManagerImplListener
51{ 51{
52 public: 52 public:
53 virtual void resourceAdded( Resource *resource ) = 0; 53 virtual void resourceAdded( Resource *resource ) = 0;
54 virtual void resourceModified( Resource *resource ) = 0; 54 virtual void resourceModified( Resource *resource ) = 0;
55 virtual void resourceDeleted( Resource *resource ) = 0; 55 virtual void resourceDeleted( Resource *resource ) = 0;
56}; 56};
57 57
58 58
59/** 59/**
60 @internal 60 @internal
61 61
62 Do not use this class directly. Use ResourceManager instead 62 Do not use this class directly. Use ResourceManager instead
63*/ 63*/
64class ManagerImpl : public QObject 64class ManagerImpl : public QObject
65{ 65{
66 Q_OBJECT 66 Q_OBJECT
67 public: 67 public:
68 ManagerImpl( const QString &family); 68 ManagerImpl( const QString &family);
69 ~ManagerImpl(); 69 ~ManagerImpl();
70 70
71 void readConfig( KConfig * ); 71 void readConfig( KConfig * );
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:
100 void createStandardConfig(); 100 void createStandardConfig();
101 101
102 Resource *readResourceConfig( const QString& identifier, bool checkActive ); 102 Resource *readResourceConfig( const QString& identifier, bool checkActive );
103 void writeResourceConfig( Resource *resource, bool checkActive ); 103 void writeResourceConfig( Resource *resource, bool checkActive );
104 104
105 void removeResource( Resource *resource ); 105 void removeResource( Resource *resource );
106 Resource *getResource( Resource *resource ); 106 Resource *getResource( Resource *resource );
107 Resource *getResource( const QString& identifier ); 107 Resource *getResource( const QString& identifier );
108 108
109 QString mFamily; 109 QString mFamily;
110 KConfig *mConfig; 110 KConfig *mConfig;
111 KConfig *mStdConfig; 111 KConfig *mStdConfig;
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
@@ -7,49 +7,49 @@
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This library is distributed in the hope that it will be useful, 12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
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
38class KConfig; 38class KConfig;
39 39
40namespace KRES { 40namespace KRES {
41 41
42class ConfigWidget; 42class ConfigWidget;
43 43
44/** 44/**
45 * @internal 45 * @internal
46 * @libdoc The KDE Resource library 46 * @libdoc The KDE Resource library
47 * 47 *
48 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this 48 * NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
49 * interface, it is in constant flux. 49 * interface, it is in constant flux.
50 * 50 *
51 * The KDE Resource framework can be used to manage resources of 51 * The KDE Resource framework can be used to manage resources of
52 * different types, organized in families. The Resource framework 52 * different types, organized in families. The Resource framework
53 * is currently used for addressbook resources in libkabc and for 53 * is currently used for addressbook resources in libkabc and for
54 * calendar resources in libkcal. 54 * calendar resources in libkcal.
55 * 55 *
@@ -218,49 +218,49 @@ kde_module_LTLIBRARIES = resourceexample.la
218 218
219resourceexample_la_SOURCES = resourceexample.cpp resourceexampleconfig.cpp 219resourceexample_la_SOURCES = resourceexample.cpp resourceexampleconfig.cpp
220resourceexample_la_LDFLAGS= $(all_libraries) -module $(KDE_PLUGIN) 220resourceexample_la_LDFLAGS= $(all_libraries) -module $(KDE_PLUGIN)
221resourceexample_la_LIBADD= -lkderesources 221resourceexample_la_LIBADD= -lkderesources
222 222
223linkdir= $(kde_datadir)/resources/family 223linkdir= $(kde_datadir)/resources/family
224link_DATA= resourceexample.desktop 224link_DATA= resourceexample.desktop
225</pre> 225</pre>
226 * 226 *
227 * 227 *
228 */ 228 */
229 229
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
234k * @ref writeConfig method. 234k * @ref writeConfig method.
235 * 235 *
236 */ 236 */
237class Resource : public QObject 237class 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();
255 255
256 /** 256 /**
257 * Write configuration information for this resource to a configuration 257 * Write configuration information for this resource to a configuration
258 * file. If you override this method, remember to call Resource::writeConfig 258 * file. If you override this method, remember to call Resource::writeConfig
259 * or Terrible Things(TM) will happen. 259 * or Terrible Things(TM) will happen.
260 * @param config Configuration to write persistence information to. 260 * @param config Configuration to write persistence information to.
261 */ 261 */
262 virtual void writeConfig( KConfig* config ); 262 virtual void writeConfig( KConfig* config );
263 263
264 /** 264 /**
265 * Open this resource, if it not already open. Increase the open 265 * Open this resource, if it not already open. Increase the open
266 * count of this object, and open the resource by calling @ref doOpen(). 266 * count of this object, and open the resource by calling @ref doOpen().
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
@@ -13,128 +13,132 @@
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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/*US 24/*US
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
45using namespace KRES; 49using 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 )
49SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, 53SelectDialog::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();
89 93
90 mainLayout->addWidget( buttonBox ); 94 mainLayout->addWidget( buttonBox );
91*/ 95*/
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
108Resource *SelectDialog::resource() 112Resource *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
116Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent ) 120Resource *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();
129 while ( it ) { 133 while ( it ) {
130 if ( !it->readOnly() ) { 134 if ( !it->readOnly() ) {
131 if ( found ) { 135 if ( found ) {
132 found = 0; 136 found = 0;
133 break; 137 break;
134 } else 138 } else
135 found = it; 139 found = it;
136 } 140 }
137 it = list.next(); 141 it = list.next();
138 } 142 }
139 143
140 if ( found ) 144 if ( found )
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
@@ -4,89 +4,89 @@
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
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_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;
34class QListBox; 34class Q3ListBox;
35 35
36namespace KRES { 36namespace KRES {
37 37
38class Resource; 38class 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();
47 * if ( !( res ) ) { 47 * if ( !( res ) ) {
48 * // no resource selected 48 * // no resource selected
49 * } else { 49 * } else {
50 * // do something with resource 50 * // do something with resource
51 * } 51 * }
52 * </pre> 52 * </pre>
53 */ 53 */
54//US class SelectDialog : KDialog 54//US class SelectDialog : KDialog
55class SelectDialog : KDialogBase 55class 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