Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / klipper / configdialog.h
blobbe5cc8c7d068712341786e3d219f3b5cc81dc769
1 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
2 /* This file is part of the KDE project
3 Copyright (C) 2000 by Carsten Pfeiffer <pfeiffer@kde.org>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
20 #ifndef CONFIGDIALOG_H
21 #define CONFIGDIALOG_H
23 #include <QCheckBox>
24 #include <QRadioButton>
25 #include <QTreeWidget>
27 #include <keditlistbox.h>
28 #include <knuminput.h>
29 #include <KConfigDialog>
31 #include "urlgrabber.h"
33 class KConfigSkeleton;
34 class KShortcutsEditor;
35 class QPushButton;
36 class QDialog;
37 class ConfigDialog;
39 class GeneralWidget : public QWidget
41 Q_OBJECT
43 friend class ConfigDialog;
45 public:
46 GeneralWidget( QWidget *parent );
47 ~GeneralWidget();
49 private Q_SLOTS:
50 void historySizeChanged( int value );
51 void slotClipConfigChanged();
53 private:
54 QCheckBox *cbMousePos, *cbSaveContents, *cbReplayAIH, *cbNoNull;
55 QCheckBox *cbIgnoreSelection, *cbStripWhitespace;
56 QRadioButton *cbSynchronize, *cbImplicitSelection, *cbSeparate;
57 KIntNumInput *popupTimeout, *maxItems;
62 // only for use inside ActionWidget
63 class AdvancedWidget : public QWidget
65 Q_OBJECT
67 public:
68 explicit AdvancedWidget( QWidget *parent = 0L );
69 ~AdvancedWidget();
71 void setWMClasses( const QStringList& items );
72 QStringList wmClasses() const { return editListBox->items(); }
74 private:
75 KEditListBox *editListBox;
78 class ActionWidget : public QWidget
80 Q_OBJECT
82 friend class ConfigDialog;
84 public:
85 ActionWidget( const ActionList *list, QWidget *parent );
86 ~ActionWidget();
88 /**
89 * Creates a list of actions from the listView and returns a pointer to
90 * the list.
91 * Make sure to free that pointer when you don't need it anymore.
93 ActionList * actionList();
95 void setWMClasses( const QStringList& items ) { m_wmClasses = items; }
96 QStringList wmClasses() const { return m_wmClasses; }
98 private Q_SLOTS:
99 void slotAddAction();
100 void slotDeleteAction();
101 void slotItemChanged(QTreeWidgetItem *item, int column);
102 void slotAdvanced();
103 void slotContextMenu(const QPoint& pos);
104 void selectionChanged();
106 private:
107 QTreeWidget *treeWidget;
108 QStringList m_wmClasses;
109 AdvancedWidget *advancedWidget;
110 QPushButton *delActionButton;
111 QCheckBox *cbUseGUIRegExpEditor;
114 class ConfigDialog : public KConfigDialog
116 Q_OBJECT
118 public:
119 ConfigDialog( QWidget *parent, KConfigSkeleton *config, const ActionList *list, KActionCollection *collection, bool isApplet );
120 ~ConfigDialog();
122 ActionList * actionList() const { return actionWidget->actionList(); }
124 bool keepContents() const {
125 return generalWidget->cbSaveContents->isChecked();
127 bool popupAtMousePos() const {
128 return generalWidget->cbMousePos->isChecked();
130 bool trimmed() const {
131 return generalWidget->cbStripWhitespace->isChecked();
133 bool replayActionInHistory() const {
134 return generalWidget->cbReplayAIH->isChecked();
136 bool noNullClipboard() const {
137 return generalWidget->cbNoNull->isChecked();
140 int popupTimeout() const {
141 return generalWidget->popupTimeout->value();
143 int maxItems() const {
144 return generalWidget->maxItems->value();
146 bool ignoreSelection() const
148 return generalWidget->cbIgnoreSelection->isChecked();
150 QStringList noActionsFor() const {
151 return actionWidget->wmClasses();
153 bool useGUIRegExpEditor() const
155 return actionWidget->cbUseGUIRegExpEditor->isChecked();
158 bool synchronize() const {
159 return generalWidget->cbSynchronize->isChecked();
161 bool implicitSelection() const {
162 return generalWidget->cbImplicitSelection->isChecked();
165 void setKeepContents( bool enable ) {
166 generalWidget->cbSaveContents->setChecked( enable );
168 void setPopupAtMousePos( bool enable ) {
169 generalWidget->cbMousePos->setChecked( enable );
171 void setStripWhiteSpace( bool enable ) {
172 generalWidget->cbStripWhitespace->setChecked( enable );
174 void setReplayActionInHistory( bool enable ) {
175 generalWidget->cbReplayAIH->setChecked( enable );
177 void setNoNullClipboard( bool enable ) {
178 generalWidget->cbNoNull->setChecked( enable );
180 void setPopupTimeout( int timeout ) {
181 generalWidget->popupTimeout->setValue( timeout );
183 void setMaxItems( int items ) {
184 generalWidget->maxItems->setValue( items );
186 void setIgnoreSelection( bool ignore ) {
187 generalWidget->cbIgnoreSelection->setChecked( ignore );
189 void setSynchronize( bool synchronize ) {
190 generalWidget->cbSynchronize->setChecked( synchronize );
192 void setNoActionsFor( const QStringList& items ) {
193 actionWidget->setWMClasses( items );
195 void setUseGUIRegExpEditor( bool enabled )
197 // the checkbox is only hidden explicitly when there's no
198 // regexp editor component available.
199 if ( !actionWidget->cbUseGUIRegExpEditor->isHidden() )
200 actionWidget->cbUseGUIRegExpEditor->setChecked( enabled );
203 void commitShortcuts();
205 private:
206 GeneralWidget *generalWidget;
207 ActionWidget *actionWidget;
208 KShortcutsEditor *shortcutsWidget;
212 #endif // CONFIGDIALOG_H