use khns3 dialog; look ma, no more memory leaks as a bonus!
svn path=/trunk/KDE/kdelibs/; revision=1084570
This commit is contained in:
parent
9e1aa5472f
commit
ead4cc9d62
@ -209,7 +209,7 @@ endif(PHONON_FOUND)
|
|||||||
|
|
||||||
kde4_add_library(plasma SHARED ${plasma_LIB_SRCS})
|
kde4_add_library(plasma SHARED ${plasma_LIB_SRCS})
|
||||||
|
|
||||||
target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} knewstuff2
|
target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} knewstuff3
|
||||||
${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
|
${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
|
||||||
kdnssd threadweaver ${KDE4_SOLID_LIBS} )
|
kdnssd threadweaver ${KDE4_SOLID_LIBS} )
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
|
|
||||||
#include <knewstuff2/engine.h>
|
#include <knewstuff3/downloaddialog.h>
|
||||||
|
|
||||||
#include "plasma/private/wallpaper_p.h"
|
#include "plasma/private/wallpaper_p.h"
|
||||||
|
|
||||||
@ -37,8 +37,7 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
||||||
: Plasma::PackageStructure(parent, QString("Plasmoid")),
|
: Plasma::PackageStructure(parent, QString("Plasmoid"))
|
||||||
m_knsEngine(0)
|
|
||||||
{
|
{
|
||||||
addDirectoryDefinition("images", "images/", i18n("Images"));
|
addDirectoryDefinition("images", "images/", i18n("Images"));
|
||||||
QStringList mimetypes;
|
QStringList mimetypes;
|
||||||
@ -69,11 +68,7 @@ PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
|||||||
|
|
||||||
PlasmoidPackage::~PlasmoidPackage()
|
PlasmoidPackage::~PlasmoidPackage()
|
||||||
{
|
{
|
||||||
delete m_knsEngine;
|
delete m_knsDialog.data();
|
||||||
}
|
|
||||||
|
|
||||||
void PlasmoidPackage::deleteNewStuffEngine()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmoidPackage::pathChanged()
|
void PlasmoidPackage::pathChanged()
|
||||||
@ -89,25 +84,14 @@ void PlasmoidPackage::pathChanged()
|
|||||||
|
|
||||||
void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
|
void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
|
||||||
{
|
{
|
||||||
//FIXME: memory leak below: it creates a new KNS::Engine every time it's called
|
KNS3::DownloadDialog *knsDialog = m_knsDialog.data();
|
||||||
// however, due to issues in the KNS2 library, reusing the same engine causes crashes :(
|
if (!knsDialog) {
|
||||||
// if (!m_knsEngine) {
|
m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent);
|
||||||
m_knsEngine = new KNS::Engine(parent);
|
connect(knsDialog, SIGNAL(accepted()), this, SIGNAL(newWidgetBrowserFinished()));
|
||||||
kDebug() << "creating new kns engine" << m_knsEngine;
|
}
|
||||||
if (!m_knsEngine->init("plasmoids.knsrc")) {
|
|
||||||
delete m_knsEngine;
|
|
||||||
m_knsEngine = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
kDebug() << "successful kns engine" << m_knsEngine;
|
knsDialog->show();
|
||||||
m_knsEngine->downloadDialog(this, SLOT(widgetBrowserFinished()));
|
knsDialog->raise();
|
||||||
}
|
|
||||||
|
|
||||||
void PlasmoidPackage::widgetBrowserFinished()
|
|
||||||
{
|
|
||||||
emit newWidgetBrowserFinished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemePackage::ThemePackage(QObject *parent)
|
ThemePackage::ThemePackage(QObject *parent)
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
#include "plasma/wallpaper.h"
|
#include "plasma/wallpaper.h"
|
||||||
#include "plasma/plasma.h"
|
#include "plasma/plasma.h"
|
||||||
|
|
||||||
namespace KNS
|
namespace KNS3
|
||||||
{
|
{
|
||||||
class Engine;
|
class DownloadDialog;
|
||||||
} // namespace KNS
|
} // namespace KNS
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
@ -43,12 +43,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void pathChanged();
|
void pathChanged();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
void widgetBrowserFinished();
|
|
||||||
void deleteNewStuffEngine();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KNS::Engine *m_knsEngine;
|
QWeakPointer<KNS3::DownloadDialog> m_knsDialog;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThemePackage : public PackageStructure
|
class ThemePackage : public PackageStructure
|
||||||
|
Loading…
Reference in New Issue
Block a user