[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/kcontrol/kfontinst/kio
From: Craig Drummond <craig () kde ! org>
Date: 2009-10-04 20:38:00
Message-ID: 1254688680.825936.21366.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1031397 by craig:
Create QCoreApplication in ioslave's main(), and use QEventLoop
exec()/quit() to wait for replies from dbus service.
M +5 -19 FontInstInterface.cpp
M +2 -2 FontInstInterface.h
M +4 -2 KioFonts.cpp
--- trunk/KDE/kdebase/workspace/kcontrol/kfontinst/kio/FontInstInterface.cpp \
#1031396:1031397 @@ -24,8 +24,6 @@
#include "FontInstInterface.h"
#include "FontinstIface.h"
#include "FontInst.h"
-#include <QtCore/QEventLoop>
-#include <QtCore/QCoreApplication>
#include <KDE/KDebug>
#include <kio/global.h>
#include "config-fontinst.h"
@@ -35,8 +33,6 @@
namespace KFI
{
-QCoreApplication * FontInstInterface::theApp=0L;
-
FontInstInterface::FontInstInterface()
: itsInterface(new \
OrgKdeFontinstInterface(OrgKdeFontinstInterface::staticInterfaceName(),
FONTINST_PATH,
@@ -44,7 +40,6 @@
? \
QDBusConnection::systemBus()
: \
QDBusConnection::sessionBus(), 0L)) , itsActive(false)
-
{
KFI_DBUG;
FontInst::registerTypes();
@@ -61,8 +56,6 @@
FontInstInterface::~FontInstInterface()
{
KFI_DBUG;
- delete theApp;
- theApp=0L;
}
int FontInstInterface::install(const QString &file, bool toSystem)
@@ -118,15 +111,8 @@
itsStatus=FontInst::STATUS_OK;
itsFamilies=Families();
itsActive=true;
- // Need a QApplication to be able to use event loop!
- if(!QCoreApplication::instance())
- {
- int dummyArgc=1;
- char *dummyArgv[]={(char *)"kio_fonts_thread"};
- theApp=new QCoreApplication(dummyArgc, dummyArgv);
- }
- QCoreApplication::exec();
+ itsEventLoop.exec();
KFI_DBUG << "Loop finished";
return itsStatus;
}
@@ -137,7 +123,7 @@
{
KFI_DBUG << "Service died :-(";
itsStatus=FontInst::STATUS_SERVICE_DIED;
- QCoreApplication::exit(0);
+ itsEventLoop.quit();
}
}
@@ -147,7 +133,7 @@
{
KFI_DBUG << "Status:" << value;
itsStatus=value;
- QCoreApplication::exit(0);
+ itsEventLoop.quit();
}
}
@@ -158,7 +144,7 @@
KFI_DBUG;
itsFamilies=1==families.count() ? *families.begin() : Families();
itsStatus=1==families.count() ? (int)FontInst::STATUS_OK : \
(int)KIO::ERR_DOES_NOT_EXIST;
- QCoreApplication::exit(0);
+ itsEventLoop.quit();
}
}
@@ -169,7 +155,7 @@
KFI_DBUG;
itsFamilies=Families(font, false);
itsStatus=font.styles().count()>0 ? (int)FontInst::STATUS_OK : \
(int)KIO::ERR_DOES_NOT_EXIST;
- QCoreApplication::exit(0);
+ itsEventLoop.quit();
}
}
--- trunk/KDE/kdebase/workspace/kcontrol/kfontinst/kio/FontInstInterface.h \
#1031396:1031397 @@ -25,10 +25,10 @@
*/
#include <QtCore/QObject>
+#include <QtCore/QEventLoop>
#include "Family.h"
class QTimer;
-class QCoreApplication;
class OrgKdeFontinstInterface;
namespace KFI
@@ -66,7 +66,7 @@
bool itsActive;
int itsStatus;
Families itsFamilies;
- static QCoreApplication *theApp;
+ QEventLoop itsEventLoop;
};
}
--- trunk/KDE/kdebase/workspace/kcontrol/kfontinst/kio/KioFonts.cpp #1031396:1031397
@@ -22,6 +22,7 @@
*/
#include <QtCore/QFile>
+#include <QtCore/QCoreApplication>
#include <KDE/KComponentData>
#include <KDE/KDebug>
#include <KDE/KMimeType>
@@ -66,8 +67,9 @@
KLocale::setMainCatalog(KFI_CATALOGUE);
- KComponentData componentData("kio_"KFI_KIO_FONTS_PROTOCOL);
- KFI::CKioFonts slave(argv[2], argv[3]);
+ KComponentData componentData("kio_"KFI_KIO_FONTS_PROTOCOL);
+ KFI::CKioFonts slave(argv[2], argv[3]);
+ QCoreApplication app(argc, argv);
slave.dispatchLoop();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic