-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 @@ -12,90 +12,93 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <klocale.h> #include <kglobal.h> #include <kmessagebox.h> -#include <qgroupbox.h> +#include <q3groupbox.h> #include <qlabel.h> #include <qlayout.h> #include <qpushbutton.h> -#include <qvbox.h> +#include <q3vbox.h> #include <qcheckbox.h> -#include <qscrollview.h> +#include <q3scrollview.h> +//Added by qt3to4: +#include <Q3VBoxLayout> +#include <Q3Frame> #include <kbuttonbox.h> #include <kdialog.h> #include <klineedit.h> #include "factory.h" #include "configwidget.h" #include "configdialog.h" using namespace KRES; ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily, Resource* resource, const char *name ) : KDialogBase( parent, name, true, i18n( "Resource Configuration" ), Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false) { Factory *factory = Factory::self( resourceFamily ); //US resize( 250, 240 ); resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240)); - QFrame *main; + Q3Frame *main; main = plainPage(); - QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() ); + Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main, 0, spacingHint() ); - QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); + Q3GroupBox *generalGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); generalGroupBox->layout()->setSpacing( spacingHint() ); generalGroupBox->setTitle( i18n( "General Settings" ) ); new QLabel( i18n( "Name:" ), generalGroupBox ); mName = new KLineEdit( generalGroupBox ); new QLabel("", generalGroupBox ); mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox ); mReadOnly->setChecked( mResource->readOnly() ); new QLabel("", generalGroupBox ); mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox ); mIncludeInSync->setChecked( mResource->includeInSync() ); mName->setText( mResource->resourceName() ); mainLayout->addWidget( generalGroupBox ); - QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main ); + Q3GroupBox *resourceGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); resourceGroupBox->layout()->setSpacing( spacingHint()); resourceGroupBox->setTitle( i18n( "%1 Resource Settings" ) .arg( factory->typeName( resource->type() ) ) ); mainLayout->addWidget( resourceGroupBox ); mainLayout->addStretch(); mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox ); if ( mConfigWidget ) { connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ), SLOT( setReadOnly( bool ) ) ); connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ), SLOT( setIncludeInSync( bool ) ) ); connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ), SLOT( setPersistentReadOnly( bool ) ) ); mConfigWidget->setInEditMode( false ); diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp index fc7a42e..1a9d063 100644 --- a/microkde/kresources/configpage.cpp +++ b/microkde/kresources/configpage.cpp @@ -15,108 +15,112 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ -#include <qgroupbox.h> +#include <q3groupbox.h> #ifdef DESKTOP_VERSION #include <qinputdialog.h> #else #include <qtcompat/qinputdialog.h> #endif #include <qlabel.h> #include <qlayout.h> +//Added by qt3to4: +#include <Q3GridLayout> +#include <Q3ValueList> +#include <Q3VBoxLayout> #include <kapplication.h> #include <kcombobox.h> #include <kdebug.h> #include <klocale.h> #include <kmessagebox.h> #include <ksimpleconfig.h> #include <kstandarddirs.h> #include <kurlrequester.h> #include <klistview.h> #include <kbuttonbox.h> //US #include <ktrader.h> #include "resource.h" #include "configdialog.h" #include "configpage.h" //US #include <qpushbutton.h> #include <qfile.h> #include <kglobal.h> using namespace KRES; -class ConfigViewItem : public QCheckListItem +class ConfigViewItem : public Q3CheckListItem { public: - ConfigViewItem( QListView *parent, Resource* resource ) : - QCheckListItem( parent, resource->resourceName(), CheckBox ), + ConfigViewItem( Q3ListView *parent, Resource* resource ) : + Q3CheckListItem( parent, resource->resourceName(), CheckBox ), mResource( resource ), mIsStandard( false ) { setText( 1, mResource->type() ); setOn( mResource->isActive() ); } void setStandard( bool value ) { setText( 2, ( value ? i18n( "Yes" ) : QString::null ) ); mIsStandard = value; } bool standard() const { return mIsStandard; } bool readOnly() const { return mResource->readOnly(); } Resource *resource() { return mResource; } private: Resource* mResource; bool mIsStandard; }; ConfigPage::ConfigPage( QWidget *parent, const char *name ) : QWidget( parent, name ), mCurrentManager( 0 ), mCurrentConfig( 0 ) { setCaption( i18n( "Resource Configuration" ) ); - QVBoxLayout *mainLayout = new QVBoxLayout( this ); + Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this ); - QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this ); + Q3GroupBox *groupBox = new Q3GroupBox( i18n( "Resources" ), this ); groupBox->setColumnLayout(0, Qt::Vertical ); groupBox->layout()->setSpacing( 3 ); groupBox->layout()->setMargin( 5 ); - QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 ); + Q3GridLayout *groupBoxLayout = new Q3GridLayout( groupBox->layout(), 4, 2 ); //US mFamilyCombo = new KComboBox( false, groupBox ); mFamilyCombo = new KComboBox( groupBox ); groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 ); mListView = new KListView( groupBox ); mListView->setAllColumnsShowFocus( true ); mListView->addColumn( i18n( "Name" ) ); mListView->addColumn( i18n( "Type" ) ); mListView->addColumn( i18n( "Standard" ) ); //US groupBoxLayout->addWidget( mListView, 1, 0 ); groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 ); mAddButton = new QPushButton( i18n( "&Add..." ), groupBox ); @@ -132,47 +136,47 @@ ConfigPage::ConfigPage( QWidget *parent, const char *name ) mEditButton->setEnabled( false ); mStandardButton->setEnabled( false ); connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) ); connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) ); connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) ); connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) ); mainLayout->addWidget( groupBox ); connect( mFamilyCombo, SIGNAL( activated( int ) ), SLOT( slotFamilyChanged( int ) ) ); connect( mListView, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() ) ); - connect( mListView, SIGNAL( clicked( QListViewItem * ) ), - SLOT( slotItemClicked( QListViewItem * ) ) ); + connect( mListView, SIGNAL( clicked( Q3ListViewItem * ) ), + SLOT( slotItemClicked( Q3ListViewItem * ) ) ); mLastItem = 0; //US mConfig = new KConfig( "kcmkresourcesrc" ); mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") ); mConfig->setGroup( "General" ); load(); } ConfigPage::~ConfigPage() { - QValueList<ResourcePageInfo>::Iterator it; + Q3ValueList<ResourcePageInfo>::Iterator it; for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) { (*it).mManager->removeListener( this ); delete (*it).mManager; delete (*it).mConfig; } mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() ); delete mConfig; mConfig = 0; } void ConfigPage::load() { kdDebug(5650) << "ConfigPage::load()" << endl; mListView->clear(); @@ -217,33 +221,33 @@ void ConfigPage::load() } } } mCurrentManager = 0; mFamilyCombo->insertStringList( mFamilyMap ); int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 ); mFamilyCombo->setCurrentItem( currentFamily ); slotFamilyChanged( currentFamily ); } void ConfigPage::save() { saveResourceSettings(); - QValueList<ResourcePageInfo>::Iterator it; + Q3ValueList<ResourcePageInfo>::Iterator it; for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) (*it).mManager->writeConfig( (*it).mConfig ); emit changed( false ); } void ConfigPage::defaults() { } void ConfigPage::slotFamilyChanged( int pos ) { if ( pos < 0 || pos >= (int)mFamilyMap.count() ) return; saveResourceSettings(); @@ -328,85 +332,85 @@ void ConfigPage::slotAdd() resource->setResourceName( type + "-resource" ); ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); if ( dlg.exec() ) { mCurrentManager->add( resource ); ConfigViewItem *item = new ConfigViewItem( mListView, resource ); mLastItem = item; // if there are only read-only resources we'll set this resource // as standard resource if ( !resource->readOnly() ) { bool onlyReadOnly = true; - QListViewItem *it = mListView->firstChild(); + Q3ListViewItem *it = mListView->firstChild(); while ( it != 0 ) { ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it ); if ( !confIt->readOnly() && confIt != item ) onlyReadOnly = false; it = it->itemBelow(); } if ( onlyReadOnly ) item->setStandard( true ); } emit changed( true ); } else { delete resource; resource = 0; } } void ConfigPage::slotRemove() { if ( !mCurrentManager ) return; - QListViewItem *item = mListView->currentItem(); + Q3ListViewItem *item = mListView->currentItem(); ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item ); if ( !confItem ) return; if ( confItem->standard() ) { KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) ); return; } mCurrentManager->remove( confItem->resource() ); if ( item == mLastItem ) mLastItem = 0; mListView->takeItem( item ); delete item; emit changed( true ); } void ConfigPage::slotEdit() { if ( !mCurrentManager ) return; - QListViewItem *item = mListView->currentItem(); + Q3ListViewItem *item = mListView->currentItem(); ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); if ( !configItem ) return; Resource *resource = configItem->resource(); ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" ); if ( dlg.exec() ) { configItem->setText( 0, resource->resourceName() ); configItem->setText( 1, resource->type() ); if ( configItem->standard() && configItem->readOnly() ) { KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) ); configItem->setStandard( false ); } @@ -422,33 +426,33 @@ void ConfigPage::slotStandard() return; ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() ); if ( !item ) return; if ( item->readOnly() ) { KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) ); return; } if ( !item->isOn() ) { KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) ); return; } - QListViewItem *it = mListView->firstChild(); + Q3ListViewItem *it = mListView->firstChild(); while ( it != 0 ) { ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it ); if ( configItem->standard() ) configItem->setStandard( false ); it = it->itemBelow(); } item->setStandard( true ); mCurrentManager->setStandardResource( item->resource() ); emit changed( true ); } void ConfigPage::slotSelectionChanged() { bool state = ( mListView->currentItem() != 0 ); @@ -469,55 +473,55 @@ void ConfigPage::resourceAdded( Resource* resource ) mLastItem = item; emit changed( true ); } void ConfigPage::resourceModified( Resource* resource ) { qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1()); } void ConfigPage::resourceDeleted( Resource* resource ) { qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1()); } -void ConfigPage::slotItemClicked( QListViewItem *item ) +void ConfigPage::slotItemClicked( Q3ListViewItem *item ) { ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item ); if ( !configItem ) return; if ( configItem->standard() && !configItem->isOn() ) { KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) ); configItem->setOn( true ); return; } if ( configItem->isOn() != configItem->resource()->isActive() ) { emit changed( true ); } } void ConfigPage::saveResourceSettings() { //qDebug("ConfigPage::saveResourceSettings() begin"); if ( mCurrentManager ) { - QListViewItem *item = mListView->firstChild(); + Q3ListViewItem *item = mListView->firstChild(); while ( item ) { ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item ); // check if standard resource if ( configItem->standard() && !configItem->readOnly() && configItem->isOn() ) { mCurrentManager->setStandardResource( configItem->resource() ); } // check if active or passive resource configItem->resource()->setActive( configItem->isOn() ); item = item->nextSibling(); } mCurrentManager->writeConfig( mCurrentConfig ); 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 @@ -12,39 +12,41 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KRESOURCES_CONFIGPAGE_H #define KRESOURCES_CONFIGPAGE_H #include <qstringlist.h> #include <qwidget.h> +//Added by qt3to4: +#include <Q3ValueList> #include "manager.h" class KComboBox; class KListView; -class QListViewItem; +class Q3ListViewItem; class QPushButton; namespace KRES { class ResourcePageInfo { public: Manager<Resource> *mManager; KConfig *mConfig; }; class Resource; class ConfigPage : public QWidget, public ManagerListener<Resource> { @@ -60,45 +62,45 @@ class ConfigPage : public QWidget, public ManagerListener<Resource> public slots: void slotFamilyChanged( int ); void slotAdd(); void slotRemove(); void slotEdit(); void slotStandard(); void slotSelectionChanged(); // From ManagerListener<Resource> public: virtual void resourceAdded( Resource* resource ); virtual void resourceModified( Resource* resource ); virtual void resourceDeleted( Resource* resource ); protected slots: - void slotItemClicked( QListViewItem * ); + void slotItemClicked( Q3ListViewItem * ); signals: void changed( bool ); private: void saveResourceSettings(); Manager<Resource>* mCurrentManager; KConfig* mCurrentConfig; KConfig* mConfig; QString mFamily; QStringList mFamilyMap; - QValueList<ResourcePageInfo> mInfoMap; + Q3ValueList<ResourcePageInfo> mInfoMap; KComboBox* mFamilyCombo; KListView* mListView; QPushButton* mAddButton; QPushButton* mRemoveButton; QPushButton* mEditButton; QPushButton* mStandardButton; - QListViewItem* mLastItem; + Q3ListViewItem* mLastItem; static const QString syncfamily; }; } #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 @@ -28,43 +28,43 @@ #include <kstaticdeleter.h> //#ifndef DESKTOP_VERSION #include <klibloader.h> //#endif #include <qfile.h> #include "resource.h" #include "factory.h" #ifdef STATIC_RESOURCES #include <file/resourcefile.h> #include <dir/resourcedir.h> #include <qtopia/resourceqtopia.h> #endif using namespace KRES; -QDict<Factory> *Factory::mSelves = 0; -static KStaticDeleter< QDict<Factory> > staticDeleter; +Q3Dict<Factory> *Factory::mSelves = 0; +static KStaticDeleter< Q3Dict<Factory> > staticDeleter; Factory *Factory::self( const QString& resourceFamily) { Factory *factory = 0; if ( !mSelves ) { - mSelves = staticDeleter.setObject( new QDict<Factory> ); + mSelves = staticDeleter.setObject( new Q3Dict<Factory> ); } factory = mSelves->find( resourceFamily ); if ( !factory ) { factory = new Factory( resourceFamily); mSelves->insert( resourceFamily, factory ); } return factory; } Factory::Factory( const QString& resourceFamily) : mResourceFamily( resourceFamily ) { //US so far we have three types available for resourceFamily "contact" 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 @@ -11,33 +11,33 @@ version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KRESOURCES_FACTORY_H #define KRESOURCES_FACTORY_H -#include <qdict.h> +#include <q3dict.h> #include <qstring.h> #include <kconfig.h> #include "resource.h" namespace KRES { class ConfigWidget; //US struct PluginInfo { QString library; QString nameLabel; @@ -101,26 +101,26 @@ class Factory QStringList typeNames() const; /** * Returns the name for a special type. */ QString typeName( const QString &type ) const; /** * Returns the description for a special type. */ QString typeDescription( const QString &type ) const; protected: Factory( const QString& resourceFamily); private: - static QDict<Factory> *mSelves; + static Q3Dict<Factory> *mSelves; QString mResourceFamily; //US QMap<QString, KService::Ptr> mTypeMap; //US lets store the pluginfo struct as value instead of a KService QMap<QString, PluginInfo*> mTypeMap; }; } #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 @@ -7,55 +7,58 @@ modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qlayout.h> +//Added by qt3to4: +#include <Q3VBoxLayout> +#include <Q3Frame> //US #include <kaboutdata.h> //US #include <kgenericfactory.h> #include <klocale.h> #include "configpage.h" #include "kcmkresources.h" using namespace KRES; //US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory; //US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) ); //US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) //US : KCModule( ResourcesFactory::instance(), parent, name ) KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& ) : KDialogBase( parent, name, true, i18n( "Configure Resources" ), Ok|Cancel, Ok, true ) { - QFrame *main = plainPage(); + Q3Frame *main = plainPage(); - QVBoxLayout *layout = new QVBoxLayout( main ); + Q3VBoxLayout *layout = new Q3VBoxLayout( main ); mConfigPage = new KRES::ConfigPage( main ); layout->addWidget( mConfigPage ); connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) ); #ifndef DESKTOP_VERSION showMaximized(); #endif } void KCMKResources::changed( bool changed) { modified = changed; } void KCMKResources::slotOk() 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 @@ -19,34 +19,36 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KRESOURCES_MANAGER_H #define KRESOURCES_MANAGER_H -#include <qdict.h> +#include <q3dict.h> #include <qstringlist.h> +//Added by qt3to4: +#include <Q3PtrList> #include "factory.h" #include "managerimpl.h" namespace KRES { class Resource; template<class T> class ManagerListener { public: virtual void resourceAdded( T *resource ) = 0; virtual void resourceModified( T *resource ) = 0; virtual void resourceDeleted( T *resource ) = 0; }; @@ -162,33 +164,33 @@ class Manager : private ManagerImplListener ActiveIterator it; it.mIt = mImpl->resourceList()->end(); it.mList = mImpl->resourceList(); return it; } bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } Manager( const QString &family ) { mFactory = Factory::self( family ); // The managerimpl will use the same Factory object as the manager // because of the Factory::self() pattern mImpl = new ManagerImpl( family ); mImpl->setListener( this ); - mListeners = new QPtrList<ManagerListener<T> >; + mListeners = new Q3PtrList<ManagerListener<T> >; } virtual ~Manager() { mImpl->setListener( 0 ); delete mListeners; delete mImpl; } /** Recreate Resource objects from configuration file. If cfg is 0, read standard configuration file. */ void readConfig( KConfig *cfg = 0 ) { mImpl->readConfig( cfg ); @@ -317,22 +319,22 @@ class Manager : private ManagerImplListener listener->resourceModified( resource ); } virtual void resourceDeleted( Resource *res ) { T* resource = (T *)( res ); ManagerListener<T> *listener; for ( listener = mListeners->first(); listener; listener = mListeners->next() ) { listener->resourceDeleted( resource ); } } private: ManagerImpl *mImpl; Factory *mFactory; - QPtrList<ManagerListener<T> > *mListeners; + Q3PtrList<ManagerListener<T> > *mListeners; }; } #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 @@ -22,32 +22,34 @@ */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kglobal.h> #include <kapplication.h> #include <kdebug.h> #include <kconfig.h> #include <kstandarddirs.h> #include <qfile.h> +//Added by qt3to4: +#include <Q3PtrList> #include "resource.h" #include "factory.h" #include "managerimpl.h" using namespace KRES; ManagerImpl::ManagerImpl( const QString &family ) : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), mFactory( 0 ) { kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; @@ -219,46 +221,46 @@ void ManagerImpl::resourceChanged( Resource *resource ) QStringList ManagerImpl::resourceNames() { QStringList result; Resource::List::ConstIterator it; for ( it = mResources.begin(); it != mResources.end(); ++it ) { result.append( (*it)->resourceName() ); } return result; } Resource::List *ManagerImpl::resourceList() { return &mResources; } -QPtrList<Resource> ManagerImpl::resources() +Q3PtrList<Resource> ManagerImpl::resources() { - QPtrList<Resource> result; + Q3PtrList<Resource> result; Resource::List::ConstIterator it; for ( it = mResources.begin(); it != mResources.end(); ++it ) { result.append( *it ); } return result; } -QPtrList<Resource> ManagerImpl::resources( bool active ) +Q3PtrList<Resource> ManagerImpl::resources( bool active ) { - QPtrList<Resource> result; + Q3PtrList<Resource> result; Resource::List::ConstIterator it; for ( it = mResources.begin(); it != mResources.end(); ++it ) { if ( (*it)->isActive() == active ) { result.append( *it ); } } return result; } void ManagerImpl::setListener( ManagerImplListener *listener ) { mListener = listener; } Resource* ManagerImpl::readResourceConfig( const QString& identifier, 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 @@ -19,34 +19,34 @@ along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #ifndef KRESOURCES_MANAGERIMPL_H #define KRESOURCES_MANAGERIMPL_H #include <qstring.h> -#include <qptrlist.h> -#include <qdict.h> +#include <q3ptrlist.h> +#include <q3dict.h> //US #include <qobject.h> #include "resource.h" class KConfig; namespace KRES { class Resource; class Factory; class ManagerImplListener { public: @@ -68,36 +68,36 @@ class ManagerImpl : public QObject ManagerImpl( const QString &family); ~ManagerImpl(); void readConfig( KConfig * ); void writeConfig( KConfig * ); void add( Resource *resource, bool useDCOP = true ); void remove( Resource *resource, bool useDCOP = true ); Resource *standardResource(); void setStandardResource( Resource *resource ); void setActive( Resource *resource, bool active ); Resource::List *resourceList(); - QPtrList<Resource> resources(); + Q3PtrList<Resource> resources(); // Get only active or passive resources - QPtrList<Resource> resources( bool active ); + Q3PtrList<Resource> resources( bool active ); QStringList resourceNames(); void setListener( ManagerImplListener *listener ); public slots: void resourceChanged( Resource *resource ); private: // dcop calls private: void createStandardConfig(); Resource *readResourceConfig( const QString& identifier, bool checkActive ); void writeResourceConfig( Resource *resource, bool checkActive ); 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 @@ -15,33 +15,33 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KRESOURCES_RESOURCE_H #define KRESOURCES_RESOURCE_H //US #ifdef QT_THREAD_SUPPORT #include <qmutex.h> #endif //QT_THREAD_SUPPORT -#include <qvaluelist.h> +#include <q3valuelist.h> #include <qwidget.h> #include <qobject.h> #include <klibloader.h> class KConfig; namespace KRES { class ConfigWidget; /** * @internal * @libdoc The KDE Resource library * @@ -226,33 +226,33 @@ link_DATA= resourceexample.desktop * * */ /** * A @ref Resource is a ... * * A subclass should reimplement at least the constructor and the k * @ref writeConfig method. * */ class Resource : public QObject { Q_OBJECT public: - typedef QValueList<Resource *> List; + typedef Q3ValueList<Resource *> List; /** * Constructor. Construct resource from config. * @param config Configuration to read persistence information from. * If config==0, create object using default settings. */ Resource( const KConfig* config ); /** * Destructor. */ virtual ~Resource(); /** * Write configuration information for this resource to a configuration * file. If you override this method, remember to call Resource::writeConfig 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 @@ -21,112 +21,116 @@ Boston, MA 02111-1307, USA. */ /*US #include <kbuttonbox.h> #include <klistbox.h> #include <klocale.h> #include <kmessagebox.h> */ #include <klocale.h> #include <kmessagebox.h> //US #include <kglobal.h> -#include <qlistbox.h> +#include <q3listbox.h> #include <qlayout.h> -#include <qgroupbox.h> +#include <q3groupbox.h> +//Added by qt3to4: +#include <Q3VBoxLayout> +#include <Q3Frame> +#include <Q3PtrList> #include "resource.h" #include "selectdialog.h" using namespace KRES; //US I am using KBaseDialog instead of KDialog //US : KDialog( parent, name, true ) -SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent, +SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent, const char *name ) : KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel, Ok, true) { //US setCaption( i18n( "Resource Selection" ) ); //US resize( 300, 200 ); resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) ); //US - QFrame *main = plainPage(); + Q3Frame *main = plainPage(); /*US QVBoxLayout *layout = new QVBoxLayout( main ); mConfigPage = new KRES::ConfigPage( main ); layout->addWidget( mConfigPage ); */ //US QVBoxLayout *mainLayout = new QVBoxLayout( this ); - QVBoxLayout *mainLayout = new QVBoxLayout( main ); + Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main ); mainLayout->setMargin( marginHint() ); //US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this ); - QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main ); + Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main ); groupBox->setTitle( i18n( "Resources" ) ); //US mResourceId = new KListBox( groupBox ); - mResourceId = new QListBox( groupBox ); + mResourceId = new Q3ListBox( groupBox ); mainLayout->addWidget( groupBox ); mainLayout->addSpacing( 40 ); /*US KButtonBox *buttonBox = new KButtonBox( this ); buttonBox->addStretch(); buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) ); buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) ); buttonBox->layout(); mainLayout->addWidget( buttonBox ); */ // setup listbox uint counter = 0; for ( uint i = 0; i < list.count(); ++i ) { Resource *resource = list.at( i ); if ( resource && !resource->readOnly() ) { mResourceMap.insert( counter, resource ); mResourceId->insertItem( resource->resourceName() ); counter++; } } mResourceId->setCurrentItem( 0 ); - connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)), + connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)), SLOT(accept()) ); } Resource *SelectDialog::resource() { if ( mResourceId->currentItem() != -1 ) return mResourceMap[ mResourceId->currentItem() ]; else return 0; } -Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent ) +Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent ) { if ( list.count() == 0 ) { KMessageBox::error( parent, i18n( "There is no resource available!" ) ); return 0; } if ( list.count() == 1 ) return list.first(); // the following lines will return a writeable resource if only _one_ writeable // resource exists Resource *found = 0; Resource *it = list.first(); while ( it ) { if ( !it->readOnly() ) { if ( found ) { found = 0; 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 @@ -12,81 +12,81 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KRESOURCES_SELECTDIALOG_H #define KRESOURCES_SELECTDIALOG_H #include <qobject.h> -#include <qptrlist.h> +#include <q3ptrlist.h> #include <qmap.h> #include <kdialogbase.h> //US class KListBox; -class QListBox; +class Q3ListBox; namespace KRES { class Resource; /** * Dialog for selecting a resource. * * Example: * * <pre> * KABC::Resource *res = KABC::SelectDialog::getResource(); * if ( !( res ) ) { * // no resource selected * } else { * // do something with resource * } * </pre> */ //US class SelectDialog : KDialog class SelectDialog : KDialogBase { // Q_OBJECT public: /** * Constructor. * @param ab The address book you want to select the resource from * @param parent The parent widget * @param name The name of the dialog */ - SelectDialog( QPtrList<Resource> list, QWidget *parent = 0, + SelectDialog( Q3PtrList<Resource> list, QWidget *parent = 0, const char *name = 0); // ~SelectDialog(); /** * Return selected resource. */ Resource *resource(); /** * Open a dialog showing the available resources and return the resource the * user has selected. Returns 0, if the dialog was canceled. */ - static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 ); + static Resource *getResource( Q3PtrList<Resource> list, QWidget *parent = 0 ); private: //US KListBox *mResourceId; - QListBox *mResourceId; + Q3ListBox *mResourceId; QMap<int, Resource*> mResourceMap; }; } #endif |