summaryrefslogtreecommitdiffstats
path: root/kicker/menuext/tom/tom.h
blob: 663cb05d6beb7c751438fac9ac1cb389b6c77972 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* This file is part of the KDE project
   Copyright (C) 2003 Aaron J. Seigo <[email protected]>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License version 2 as published by the Free Software Foundation.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef __tom_h_
#define __tom_h_

#include <qpixmap.h>

#include <kpanelmenu.h>
#include <klibloader.h>

class KPopupMenu;
class QPopupMenu;

typedef QPtrList<QPopupMenu> PopupMenuList;
typedef QMap<int, KService::Ptr> TaskMap;

class TOM : public KPanelMenu
{
    Q_OBJECT

    public:
        TOM(QWidget *parent = 0, const char *name = 0);
        ~TOM();

        // for the side image
        /*void setMinimumSize(const QSize &);
        void setMaximumSize(const QSize &);
        void setMinimumSize(int, int);
        void setMaximumSize(int, int);  */

    protected slots:
        void slotClear();
        void slotExec(int);
        //void configChanged();
        void initialize();
        void contextualizeRMBmenu(KPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu);
        //void paletteChanged();
        void clearRecentDocHistory();
        void runCommand();
        void runTask(int id);
        void initializeRecentDocs();
        void openRecentDocument(int id);
        void logout();

        /*
         * slots for the RMB menu on task group
         */
        void removeTask();

    protected:
        void reload();

        int  appendTaskGroup(KConfig& config, bool inSubMenu = true );
        void initializeRecentApps(QPopupMenu* menu);
        //int  insertTOMTitle(QPopupMenu* menu, const QString &text, int id = -1, int index = -1);

        /*
         * this stuff should be shared w/the kmenu

        QRect sideImageRect();
        QMouseEvent translateMouseEvent( QMouseEvent* e );
        void resizeEvent(QResizeEvent *);
        void paintEvent(QPaintEvent *);
        void mousePressEvent(QMouseEvent *);
        void mouseReleaseEvent(QMouseEvent *);
        void mouseMoveEvent(QMouseEvent *);
        bool loadSidePixmap();

        QPixmap m_sidePixmap;
        QPixmap m_sideTilePixmap;*/
        PopupMenuList m_submenus;
        QFont m_largerFont;
        int m_maxIndex;
        bool m_isImmutable;
        bool m_detailedTaskEntries;
        bool m_detailedNamesFirst;
        TaskMap m_tasks;
        KPopupMenu* m_recentDocsMenu;
        QStringList m_recentDocURLs;
};

class TOMFactory : public KLibFactory
{
    public:
        TOMFactory(QObject *parent = 0, const char *name = 0);

    protected:
        QObject* createObject(QObject *parent = 0, const char *name = 0,
                              const char *classname = "QObject",
                              const QStringList& args = QStringList());
};


#endif