summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/managerimpl.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kresources/managerimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/managerimpl.cpp10
1 files changed, 6 insertions, 4 deletions
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
@@ -1,85 +1,87 @@
/*
This file is part of libkresources.
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
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.
*/
/*
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;
}
ManagerImpl::~ManagerImpl()
{
kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
delete *it;
}
delete mStdConfig;
}
void ManagerImpl::createStandardConfig()
{
if ( !mStdConfig ) {
QString file = locateLocal( "data", KGlobal::getAppName()
+ "/kresources/" + mFamily + "rc" );
if ( mFamily == "tmpcontact" ) {
if (QFile::exists ( file ) ){
QFile::remove ( file );
qDebug("removed tmp rc file: %s ", file.latin1());
}
}
mStdConfig = new KConfig( file );
}
mConfig = mStdConfig;
}
@@ -187,110 +189,110 @@ void ManagerImpl::remove( Resource *resource, bool useDCOP )
kdDebug(5650) << "Finished ManagerImpl::remove()" << endl;
}
void ManagerImpl::setActive( Resource *resource, bool active )
{
if ( resource && resource->isActive() != active ) {
resource->setActive( active );
}
}
Resource *ManagerImpl::standardResource()
{
return mStandard;
}
void ManagerImpl::setStandardResource( Resource *resource )
{
mStandard = resource;
}
void ManagerImpl::resourceChanged( Resource *resource )
{
writeResourceConfig( resource, true );
// ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() );
// allManagers.dcopResourceModified( resource->identifier() );
}
// DCOP asynchronous functions
//US since we work from inside the application, we call the methods directly.
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,
bool checkActive )
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
#ifdef _WIN32_
// we use plugins on win32. the group is stored in a static variable
// such that gourp info not avail on win32 plugins
// to fix that, it would be a looooot of work
mConfig->setTempGroup( "Resource_" + identifier );
#endif
QString type = mConfig->readEntry( "ResourceType" );
QString name = mConfig->readEntry( "ResourceName" );
Resource *resource = mFactory->resource( type, mConfig );
if ( !resource ) {
qDebug("Failed to create resource with id %s ",identifier.latin1() );
return 0;
}
if ( resource->identifier().isEmpty() )
resource->setIdentifier( identifier );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( standardKey == identifier ) {
mStandard = resource;
}
if ( checkActive ) {