1 /****************************************************************************
5 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
11 #define _ACTION_GROUP_TAB_CPP_
15 #include "action_group_tab.h"
21 #include <kmessagebox.h>
22 #include <ktextedit.h>
25 #include <action_data.h>
27 #include "kcmkhotkeys.h"
32 Action_group_tab::Action_group_tab( QWidget
* parent_P
, const char* name_P
)
33 : Action_group_tab_ui( parent_P
)
35 setObjectName(name_P
);
37 // KHotKeys::Module::changed()
38 connect( action_name_lineedit
, SIGNAL( textChanged( const QString
& )),
39 module
, SLOT( changed()));
40 connect( disable_checkbox
, SIGNAL( clicked()),
41 module
, SLOT( changed()));
42 connect( comment_multilineedit
, SIGNAL( textChanged()),
43 module
, SLOT( changed()));
46 void Action_group_tab::clear_data()
48 disconnect( action_name_lineedit
, SIGNAL( textChanged( const QString
& )), this,
49 SLOT( action_group_name_changed( const QString
& )));
50 action_name_lineedit
->clear();
51 action_name_lineedit
->setReadOnly( false );
52 disable_checkbox
->setChecked( false );
53 disable_checkbox
->setText( i18n( "&Disable" ));
54 comment_multilineedit
->clear();
55 system_group
= Action_data_group::SYSTEM_NONE
;
58 void Action_group_tab::set_data( const Action_data_group
* data_P
)
65 action_name_lineedit
->setText( data_P
->name());
66 action_name_lineedit
->setReadOnly( data_P
->is_system_group());
67 disable_checkbox
->setChecked( !data_P
->enabled( true ));
69 if( data_P
->parent() && !data_P
->parent()->enabled( false ))
70 disable_checkbox
->setText( i18n( "&Disable (group is disabled)" ));
72 disable_checkbox
->setText( i18n( "&Disable" ));
73 comment_multilineedit
->setPlainText( data_P
->comment());
74 connect( action_name_lineedit
, SIGNAL( textChanged( const QString
& )), this,
75 SLOT( action_group_name_changed( const QString
& )));
76 system_group
= data_P
->system_group();
79 Action_data_group
* Action_group_tab::get_data( Action_data_group
* parent_P
,
80 Condition_list
* conditions_P
) const
82 QString name
= action_name_lineedit
->text();
83 return new Action_data_group( parent_P
, name
, comment_multilineedit
->toPlainText(), conditions_P
,
84 system_group
, !disable_checkbox
->isChecked());
87 void Action_group_tab::action_group_name_changed( const QString
& name_P
)
89 module
->action_name_changed( name_P
);
92 } // namespace KHotKeys
94 #include "action_group_tab.moc"