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

« back to all changes in this revision

Viewing changes to plasma/generic/applets/icon/icon.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 2007 by Aaron Seigo <aseigo@kde.org                     *
 
3
 *                                                                         *
 
4
 *   This program is free software; you can redistribute it and/or modify  *
 
5
 *   it under the terms of the GNU General Public License as published by  *
 
6
 *   the Free Software Foundation; either version 2 of the License, or     *
 
7
 *   (at your option) any later version.                                   *
 
8
 *                                                                         *
 
9
 *   This program 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         *
 
12
 *   GNU General Public License for more details.                          *
 
13
 *                                                                         *
 
14
 *   You should have received a copy of the GNU General Public License     *
 
15
 *   along with this program; if not, write to the                         *
 
16
 *   Free Software Foundation, Inc.,                                       *
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
 
18
 ***************************************************************************/
 
19
 
 
20
#ifndef ICON_APPLET_H
 
21
#define ICON_APPLET_H
 
22
 
 
23
#include <KMimeType>
 
24
#include <KUrl>
 
25
#include <KDirWatch>
 
26
#include <KService>
 
27
 
 
28
#include <Plasma/Applet>
 
29
 
 
30
class KPropertiesDialog;
 
31
 
 
32
namespace Plasma
 
33
{
 
34
    class IconWidget;
 
35
}
 
36
 
 
37
class IconApplet : public Plasma::Applet
 
38
{
 
39
    Q_OBJECT
 
40
    public:
 
41
        IconApplet(QObject *parent, const QVariantList &args);
 
42
        ~IconApplet();
 
43
 
 
44
        void init();
 
45
        void setUrl(const KUrl& url);
 
46
        void constraintsEvent(Plasma::Constraints constraints);
 
47
        void setDisplayLines(int displayLines);
 
48
        int displayLines();
 
49
        QPainterPath shape() const;
 
50
 
 
51
    public slots:
 
52
        void openUrl();
 
53
        void updateDesktopFile();
 
54
        void configChanged();
 
55
 
 
56
    protected:
 
57
        void dropEvent(QGraphicsSceneDragDropEvent *event);
 
58
        void saveState(KConfigGroup &cg) const;
 
59
        void showConfigurationInterface();
 
60
        QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
 
61
 
 
62
    private slots:
 
63
        void acceptedPropertiesDialog();
 
64
        void propertiesDialogClosed();
 
65
        void delayedDestroy();
 
66
        void checkExistenceOfUrl();
 
67
        void checkService(const QStringList &service);
 
68
        void iconSizeChanged(int group);
 
69
 
 
70
    private:
 
71
        //dropUrls from DolphinDropController
 
72
        void dropUrls(const KUrl::List& urls,
 
73
                      const KUrl& destination,
 
74
                      Qt::KeyboardModifiers modifier);
 
75
 
 
76
        Plasma::IconWidget* m_icon;
 
77
        QString m_text;
 
78
        QString m_genericName;
 
79
        KPropertiesDialog *m_dialog;
 
80
        KUrl m_url;
 
81
        KDirWatch *m_watcher;
 
82
        QSize m_lastFreeSize;
 
83
        KService::Ptr m_service;
 
84
};
 
85
 
 
86
K_EXPORT_PLASMA_APPLET(icon, IconApplet)
 
87
 
 
88
#endif