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

« back to all changes in this revision

Viewing changes to plasma/desktop/applets/kickoff/ui/launcher.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 Robert Knight <robertknight@gmail.com>
 
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
#ifndef LAUNCHER_H
 
21
#define LAUNCHER_H
 
22
 
 
23
// Qt
 
24
#include <QModelIndex>
 
25
#include <QWidget>
 
26
 
 
27
// Plasma
 
28
#include <Plasma/Applet>
 
29
 
 
30
namespace Kickoff
 
31
{
 
32
 
 
33
/**
 
34
 * The main window class for the Kickoff launcher.  This class is responsible
 
35
 * for creating the various tabs, views and models which make up the launcher's
 
36
 * user interface.
 
37
 */
 
38
class Launcher : public QWidget
 
39
{
 
40
    Q_OBJECT
 
41
 
 
42
public:
 
43
    /** Construct a new Launcher with the specified parent. */
 
44
    explicit Launcher(QWidget *parent = 0);
 
45
    /** Construct a new Launcher associated with the specified Plasma::Applet. */
 
46
    explicit Launcher(Plasma::Applet *applet = 0);
 
47
    ~Launcher();
 
48
 
 
49
    /** Specifies whether the launcher should hide itself when an item is activated. */
 
50
    void setAutoHide(bool autoHide);
 
51
    bool autoHide() const;
 
52
 
 
53
    /** Specifies whether the application names in the launcher should be displayed *
 
54
        before or after the description                                             */
 
55
    void setShowAppsByName(bool showAppByName);
 
56
    bool showAppsByName() const;
 
57
 
 
58
    /** Specifies whether hovering switches between tabs or if a click is required to switch the tabs. */
 
59
    void setSwitchTabsOnHover(bool switchOnHover);
 
60
    bool switchTabsOnHover() const;
 
61
 
 
62
    /** Specifies the number of visible items used to determinate the visible height. */
 
63
    void setVisibleItemCount(int count);
 
64
    int visibleItemCount() const;
 
65
 
 
66
    /** Specifies the plasma applet the launcher is working on. */
 
67
    void setApplet(Plasma::Applet *applet);
 
68
 
 
69
    /** Specifies the direction the launcher is popping up in relative to its icon */
 
70
    void setLauncherOrigin(const Plasma::PopupPlacement placement, Plasma::Location location);
 
71
 
 
72
    // reimplemented
 
73
    virtual bool eventFilter(QObject *object, QEvent *event);
 
74
    virtual QSize minimumSizeHint() const;
 
75
    virtual QSize sizeHint() const;
 
76
 
 
77
    /** Reset the launcher. This is called e.g. by the Kickoff-applet before shown to be sure
 
78
    we don't display old searches and switch back to the favorite-view. */
 
79
    void reset();
 
80
 
 
81
signals:
 
82
    void aboutToHide();
 
83
    void configNeedsSaving();
 
84
 
 
85
protected:
 
86
    virtual void keyPressEvent(QKeyEvent *event);
 
87
    virtual void showEvent(QShowEvent *event);
 
88
    virtual void hideEvent(QHideEvent *event);
 
89
 
 
90
private Q_SLOTS:
 
91
    void focusSearchView(const QString& query);
 
92
    void showViewContextMenu(const QPoint& pos);
 
93
    void focusFavoritesView();
 
94
    void resultsAvailable();
 
95
    void updateThemedPalette();
 
96
    void fillBreadcrumbs(const QModelIndex &index);
 
97
    void breadcrumbActivated();
 
98
 
 
99
private:
 
100
    void addBreadcrumb(const QModelIndex &index, bool isLeaf);
 
101
    void init();
 
102
 
 
103
    class Private;
 
104
    Private * const d;
 
105
};
 
106
 
 
107
}
 
108
 
 
109
#endif // LAUNCHER_H