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

« back to all changes in this revision

Viewing changes to libs/taskmanager/launcheritem.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
 
 
3
Copyright 2010 Anton Kreuzkamp <akreuzkamp@web.de>
 
4
 
 
5
Permission is hereby granted, free of charge, to any person obtaining a copy
 
6
of this software and associated documentation files (the "Software"), to deal
 
7
in the Software without restriction, including without limitation the rights
 
8
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
9
copies of the Software, and to permit persons to whom the Software is
 
10
furnished to do so, subject to the following conditions:
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
******************************************************************/
 
23
#ifndef LAUNCHERITEM_H
 
24
#define LAUNCHERITEM_H
 
25
 
 
26
#include "abstractgroupableitem.h"
 
27
#include "taskmanager_export.h"
 
28
 
 
29
// KDE
 
30
#include <KDE/KIcon>
 
31
#include <KDE/KUrl>
 
32
 
 
33
 
 
34
namespace TaskManager
 
35
{
 
36
 
 
37
class LauncherItemPrivate;
 
38
 
 
39
/** 
 
40
 * An item shown in the taskmanager, in order to use it to launch the application (or file) the launcher is linked to.
 
41
 * If the Application is running the launcher gets hidden, in order to not waste space.
 
42
 */
 
43
class TASKMANAGER_EXPORT LauncherItem : public AbstractGroupableItem
 
44
{
 
45
    Q_OBJECT
 
46
public:
 
47
    /** 
 
48
     * Creates a LauncherItem for a executable
 
49
     * @param url the URL to the application or file the launcher gets linked to
 
50
     */
 
51
    LauncherItem(QObject *parent, const KUrl &url);
 
52
    ~LauncherItem();
 
53
 
 
54
    /**
 
55
    * @deprecated: use itemType() instead
 
56
    **/
 
57
    KDE_DEPRECATED bool isGroupItem() const;
 
58
    ItemType itemType() const;
 
59
 
 
60
    bool isValid() const;
 
61
    QIcon icon() const;
 
62
    QString name() const;
 
63
    QString genericName() const;
 
64
 
 
65
    void setIcon(const QIcon &icon);
 
66
    void setName(const QString &name);
 
67
    void setGenericName(const QString &genericName);
 
68
 
 
69
    // bookkeeping methods for showing/not showing
 
70
    void associateItemIfMatches(AbstractGroupableItem *item);
 
71
    void removeItemIfAssociated(AbstractGroupableItem *item);
 
72
    bool shouldShow() const;
 
73
 
 
74
    //reimplemented pure virtual methods from abstractgroupableitem
 
75
    bool isOnCurrentDesktop() const;
 
76
    bool isOnAllDesktops() const;
 
77
    int desktop() const;
 
78
    bool isShaded() const;
 
79
    bool isMaximized() const;
 
80
    bool isMinimized() const;
 
81
    bool isFullScreen() const;
 
82
    bool isKeptBelowOthers() const;
 
83
    bool isAlwaysOnTop() const;
 
84
    bool isActionSupported(NET::Action) const;
 
85
    bool isActive() const;
 
86
    bool demandsAttention() const;
 
87
    void addMimeData(QMimeData *mimeData) const;
 
88
    KUrl launcherUrl() const;
 
89
    void setLauncherUrl(const KUrl &url);
 
90
 
 
91
public Q_SLOTS:
 
92
    void toDesktop(int);
 
93
 
 
94
    void setShaded(bool);
 
95
    void toggleShaded();
 
96
 
 
97
    void setMaximized(bool);
 
98
    void toggleMaximized();
 
99
 
 
100
    void setMinimized(bool);
 
101
    void toggleMinimized();
 
102
 
 
103
    void setFullScreen(bool);
 
104
    void toggleFullScreen();
 
105
 
 
106
    void setKeptBelowOthers(bool);
 
107
    void toggleKeptBelowOthers();
 
108
 
 
109
    void setAlwaysOnTop(bool);
 
110
    void toggleAlwaysOnTop();
 
111
 
 
112
    void close();
 
113
 
 
114
    void launch();
 
115
 
 
116
Q_SIGNALS:
 
117
    void show(bool shouldShow);
 
118
 
 
119
private:
 
120
    friend class LauncherItemPrivate;
 
121
    LauncherItemPrivate * const d;
 
122
    
 
123
    //preferred applications hack
 
124
    QString defaultApplication(QString application, bool storageId = false);
 
125
    
 
126
    Q_PRIVATE_SLOT(d, void associateDestroyed(QObject *obj))
 
127
};
 
128
 
 
129
} // TaskManager namespace
 
130
 
 
131
#endif