summaryrefslogtreecommitdiffstats
path: root/krename/helpdialog.h
blob: f15f5414bffe0aa35a66982e4fb63aa5fa29f630 (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
111
/***************************************************************************
                          helpdialog.h  -  description
                             -------------------
    begin                : Fr Nov 15 13:44:19 CEST 2001
    copyright            : (C) 2002 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef HELPDIALOG_H
#define HELPDIALOG_H

#include <qdialog.h>
#include <qstringlist.h>
#include <qpixmap.h>
#include <qmap.h>

class QVBoxLayout; 
class QHBoxLayout; 
class QGridLayout; 
class QComboBox;
class QLineEdit;
class QPixmap;
class KListView;
class KPushButton;

class HelpDialogData : public QObject {
    Q_OBJECT
    public:
        HelpDialogData() {}
        ~HelpDialogData() {}
        
        void add( const QString & headline, QStringList* commands, const QPixmap & icon, bool first = false );
        void remove( const QString & headline );
        
        /** returns all available and supported tokens 
          */
        QStringList tokens() const;
    
        inline const QMap<QString,QStringList> & map() const
        {
            return m_map;
        }
        
        inline const QMap<QString,QPixmap> & icons() const
        {
            return m_icons;
        }
        
        inline const QString & first() const 
        {
            return m_first;
        }
        
    signals:
        void updateHeadline();
        void updateItems();
        
    private:
        QMap<QString,QStringList> m_map;
        QMap<QString,QPixmap> m_icons;
    
        QString m_first;
};

class HelpDialog : public QDialog
{ 
    Q_OBJECT
    public:
        HelpDialog( HelpDialogData* data, QWidget* parent = 0,
            const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
        ~HelpDialog();

        inline void setLineEdit( QLineEdit* lineedit );

    public slots:
        void updateItems();
        void updateHeadline();
        
    private slots:
        void execute();

    private:        
        QComboBox* comboHeadline;
        KListView* list;
        KPushButton* buttonAdd;
        KPushButton* buttonClose;

    protected:
        HelpDialogData* m_data;
        
        QLineEdit* text;

        QVBoxLayout* HelpDialogLayout;
        QHBoxLayout* Layout1;
};

void HelpDialog::setLineEdit( QLineEdit* lineedit )
{ 
     text = lineedit; 
}

#endif // HELPDIALOG_H