~neon/plasmate/frameworks

« back to all changes in this revision

Viewing changes to plasmate/plugins/savesystemview/savesystemviewplugin.cpp

  • Committer: Giorgos Tsiapaliokas
  • Date: 2015-03-14 12:58:48 UTC
  • mfrom: (972.1.19)
  • Revision ID: git-v1:7b24cb2599e2bea0612cb492d2395bb6c44722ed
Merge branch 'review_savesystem_updated' into frameworks

REVIEW: 121206

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   Copyright 2014 Giorgos Tsiapaliokas <giorgos.tsiapaliokas@kde.org>
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this library; see the file COPYING.LIB.  If not, write to
 
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
   Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
#include "savesystemviewplugin.h"
 
21
#include "savesystemview.h"
 
22
 
 
23
#include <interfaces/icore.h>
 
24
#include <interfaces/iuicontroller.h>
 
25
#include <interfaces/iplugincontroller.h>
 
26
 
 
27
#include <QAction>
 
28
 
 
29
#include <KActionCollection>
 
30
#include <KLocalizedString>
 
31
 
 
32
K_PLUGIN_FACTORY(KDevSaveSystemFactory, registerPlugin<SaveSystemViewPlugin>(); )
 
33
 
 
34
class KDevSaveSystemViewFactory: public KDevelop::IToolViewFactory
 
35
{
 
36
    public:
 
37
        KDevSaveSystemViewFactory(SaveSystemViewPlugin *plugin)
 
38
            : m_plugin(plugin)
 
39
        {
 
40
        }
 
41
        virtual QWidget* create(QWidget *parent = 0)
 
42
        {
 
43
            SaveSystemView *view = new SaveSystemView(m_plugin);
 
44
            return QWidget::createWindowContainer(view, parent);
 
45
        }
 
46
        virtual Qt::DockWidgetArea defaultPosition()
 
47
        {
 
48
            return Qt::LeftDockWidgetArea;
 
49
        }
 
50
        virtual QString id() const
 
51
        {
 
52
            return "org.kdevelop.SaveSystemView";
 
53
        }
 
54
    private:
 
55
        SaveSystemViewPlugin *m_plugin;
 
56
};
 
57
 
 
58
SaveSystemViewPlugin::SaveSystemViewPlugin(QObject *parent, const QVariantList&)
 
59
    : IPlugin("kdevsavesystemview", parent),
 
60
      m_factory(new KDevSaveSystemViewFactory(this))
 
61
{
 
62
    setXMLFile("kdevsavesystemview.rc");
 
63
    KDevelop::ICore::self()->uiController()->addToolView(i18n("Save System"), m_factory);
 
64
}
 
65
 
 
66
SaveSystemViewPlugin::~SaveSystemViewPlugin()
 
67
{
 
68
}
 
69
 
 
70
void SaveSystemViewPlugin::unload()
 
71
{
 
72
    KDevelop::ICore::self()->uiController()->removeToolView(m_factory);
 
73
}
 
74
 
 
75
 
 
76
#include "savesystemviewplugin.moc"
 
77