~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/applets/quicklaunch/quicklaunch.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2008 by Lukas Appelhans <l.appelhans@gmx.de>            *
 
3
 *   Copyright (C) 2010 - 2011 by Ingomar Wesp <ingomar@wesp.name>         *
 
4
 *                                                                         *
 
5
 *   This program is free software; you can redistribute it and/or modify  *
 
6
 *   it under the terms of the GNU General Public License as published by  *
 
7
 *   the Free Software Foundation; either version 2 of the License, or     *
 
8
 *   (at your option) any later version.                                   *
 
9
 *                                                                         *
 
10
 *   This program is distributed in the hope that it will be useful,       *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
13
 *   GNU General Public License for more details.                          *
 
14
 *                                                                         *
 
15
 *   You should have received a copy of the GNU General Public License     *
 
16
 *   along with this program; if not, write to the                         *
 
17
 *   Free Software Foundation, Inc.,                                       *
 
18
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 
19
 ***************************************************************************/
 
20
#ifndef QUICKLAUNCH_QUICKLAUNCH_H
 
21
#define QUICKLAUNCH_QUICKLAUNCH_H
 
22
 
 
23
#include "ui_quicklaunchConfig.h"
 
24
 
 
25
// Qt
 
26
#include <Qt>
 
27
#include <QtGlobal>
 
28
#include <QtCore/QObject>
 
29
#include <QtCore/QPoint>
 
30
#include <QtCore/QPointF>
 
31
#include <QtCore/QSize>
 
32
#include <QtCore/QSizeF>
 
33
#include <QtCore/QStringList>
 
34
 
 
35
// Plasma
 
36
#include <Plasma/Applet>
 
37
 
 
38
class KUrl;
 
39
 
 
40
namespace Plasma
 
41
{
 
42
    class Dialog;
 
43
    class IconWidget;
 
44
}
 
45
 
 
46
class QEvent;
 
47
class QGraphicsLinearLayout;
 
48
class QGraphicsSceneContextMenuEvent;
 
49
class QPoint;
 
50
 
 
51
class KConfigGroup;
 
52
 
 
53
using Plasma::Constraints;
 
54
 
 
55
namespace Quicklaunch {
 
56
 
 
57
class LauncherGrid;
 
58
class Popup;
 
59
 
 
60
class Quicklaunch : public Plasma::Applet
 
61
{
 
62
    Q_OBJECT
 
63
 
 
64
public:
 
65
    Quicklaunch(QObject *parent, const QVariantList &args);
 
66
    ~Quicklaunch();
 
67
 
 
68
    void init();
 
69
 
 
70
    void createConfigurationInterface(KConfigDialog *parent);
 
71
    bool eventFilter(QObject *watched, QEvent *event);
 
72
 
 
73
protected:
 
74
    void constraintsEvent(Constraints constraints);
 
75
    void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
 
76
 
 
77
private Q_SLOTS:
 
78
    void configChanged();
 
79
    void iconSizeChanged();
 
80
    void onConfigAccepted();
 
81
    void onLaunchersChanged();
 
82
    void onPopupTriggerClicked();
 
83
    void onAddLauncherAction();
 
84
    void onEditLauncherAction();
 
85
    void onRemoveLauncherAction();
 
86
 
 
87
private:
 
88
    void showContextMenu(
 
89
        const QPoint& screenPos,
 
90
        bool onPopup,
 
91
        int iconIndex);
 
92
 
 
93
    void initActions();
 
94
    void initPopup();
 
95
    void updatePopupTrigger();
 
96
    void deletePopup();
 
97
 
 
98
    static QStringList defaultLaunchers();
 
99
    static QString defaultBrowserPath();
 
100
    static QString defaultFileManagerPath();
 
101
    static QString defaultEmailClientPath();
 
102
 
 
103
    static QString determineNewDesktopFilePath(const QString &baseName);
 
104
 
 
105
    Ui::quicklaunchConfig uiConfig;
 
106
 
 
107
    LauncherGrid *m_launcherGrid;
 
108
 
 
109
    QGraphicsLinearLayout *m_layout;
 
110
    Plasma::IconWidget *m_popupTrigger;
 
111
    Popup *m_popup;
 
112
 
 
113
    QAction* m_addLauncherAction;
 
114
    QAction* m_editLauncherAction;
 
115
    QAction* m_removeLauncherAction;
 
116
 
 
117
    bool m_contextMenuTriggeredOnPopup;
 
118
    int m_contextMenuLauncherIndex;
 
119
};
 
120
}
 
121
 
 
122
#endif /* QUICKLAUNCH_QUICKLAUNCH_H */