diff --git a/plugins/dashboard/dashboardview.cpp b/plugins/dashboard/dashboardview.cpp index db706886e4..766e5077c1 100644 --- a/plugins/dashboard/dashboardview.cpp +++ b/plugins/dashboard/dashboardview.cpp @@ -1,49 +1,55 @@ /* This file is part of KDevelop Copyright 2010 Aleix Pol Gonzalez 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "dashboardview.h" #include #include "dashboardcorona.h" #include #include "dashboard.h" #include #include #include #include using namespace Plasma; DashboardView::DashboardView(KDevelop::IProject* project, Sublime::Document* doc, Sublime::View::WidgetOwnership ws) : View(doc, ws), m_project(project) {} +DashboardView::~DashboardView() +{ + delete m_dashboard.data(); +} + QWidget* DashboardView::createWidget(QWidget* parent) { KUrl originalUrl=m_project->projectFileUrl().toLocalFile(); KUrl customUrl=originalUrl.upUrl(); customUrl.addPath(".kdev4/_custom.kdev4"); if(!QFile::exists(customUrl.toLocalFile())) { KIO::CopyJob* job=KIO::copy(originalUrl, customUrl); KIO::NetAccess::synchronousRun(job, 0); } DashboardCorona* corona=new DashboardCorona(m_project, this); corona->initializeLayout(customUrl.toLocalFile()); //TODO: decide what to do with remote files - return new Dashboard(corona); + m_dashboard=QWeakPointer(new Dashboard(corona)); + return m_dashboard.data(); } diff --git a/plugins/dashboard/dashboardview.h b/plugins/dashboard/dashboardview.h index 5822df3eee..4e080546e1 100644 --- a/plugins/dashboard/dashboardview.h +++ b/plugins/dashboard/dashboardview.h @@ -1,38 +1,42 @@ /* This file is part of KDevelop Copyright 2010 Aleix Pol Gonzalez 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DASHBOARDVIEW_H #define DASHBOARDVIEW_H #include +#include +class Dashboard; namespace KDevelop { class IProject; } class DashboardView : public Sublime::View { public: DashboardView(KDevelop::IProject* project, Sublime::Document* doc, WidgetOwnership ws = DoNotTakeOwnerShip); - + virtual ~DashboardView(); + virtual QWidget* createWidget(QWidget* parent); private: KDevelop::IProject* m_project; + QWeakPointer m_dashboard; }; #endif // DASHBOARDVIEW_H