00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "knotifywidgetbase.h"
00012
00013 #include <qvariant.h>
00014 #include <kdialog.h>
00015 #include <klistview.h>
00016 #include <kurlrequester.h>
00017 #include <klineedit.h>
00018 #include <kpushbutton.h>
00019 #include <kcombobox.h>
00020 #include <qpushbutton.h>
00021 #include <qheader.h>
00022 #include <qgroupbox.h>
00023 #include <qcheckbox.h>
00024 #include <qlayout.h>
00025 #include <qtooltip.h>
00026 #include <qwhatsthis.h>
00027
00028
00029
00030
00031
00032 KNotifyWidgetBase::KNotifyWidgetBase( QWidget* parent, const char* name, WFlags fl )
00033 : QWidget( parent, name, fl )
00034 {
00035 if ( !name )
00036 setName( "KNotifyWidgetBase" );
00037 KNotifyWidgetBaseLayout = new QVBoxLayout( this, 0, KDialog::spacingHint(), "KNotifyWidgetBaseLayout");
00038
00039 m_listview = new KListView( this, "m_listview" );
00040 m_listview->addColumn( QString::null );
00041 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00042 m_listview->addColumn( QString::null );
00043 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00044 m_listview->addColumn( QString::null );
00045 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00046 m_listview->addColumn( QString::null );
00047 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00048 m_listview->addColumn( QString::null );
00049 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00050 m_listview->addColumn( QString::null );
00051 m_listview->header()->setResizeEnabled( FALSE, m_listview->header()->count() - 1 );
00052 m_listview->addColumn( tr2i18n( "Events" ) );
00053 m_listview->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 10, 0, m_listview->sizePolicy().hasHeightForWidth() ) );
00054 KNotifyWidgetBaseLayout->addWidget( m_listview );
00055
00056 m_controlsBox = new QGroupBox( this, "m_controlsBox" );
00057 m_controlsBox->setColumnLayout(0, Qt::Vertical );
00058 m_controlsBox->layout()->setSpacing( KDialog::spacingHint() );
00059 m_controlsBox->layout()->setMargin( KDialog::marginHint() );
00060 m_controlsBoxLayout = new QGridLayout( m_controlsBox->layout() );
00061 m_controlsBoxLayout->setAlignment( Qt::AlignTop );
00062
00063 m_affectAllApps = new QCheckBox( m_controlsBox, "m_affectAllApps" );
00064
00065 m_controlsBoxLayout->addMultiCellWidget( m_affectAllApps, 0, 0, 0, 3 );
00066 Spacer3_2 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
00067 m_controlsBoxLayout->addMultiCell( Spacer3_2, 1, 2, 0, 0 );
00068 Spacer17 = new QSpacerItem( 318, 16, QSizePolicy::Expanding, QSizePolicy::Minimum );
00069 m_controlsBoxLayout->addItem( Spacer17, 2, 3 );
00070
00071 m_buttonDisable = new QPushButton( m_controlsBox, "m_buttonDisable" );
00072
00073 m_controlsBoxLayout->addWidget( m_buttonDisable, 2, 1 );
00074
00075 m_buttonEnable = new QPushButton( m_controlsBox, "m_buttonEnable" );
00076
00077 m_controlsBoxLayout->addWidget( m_buttonEnable, 1, 1 );
00078
00079 m_comboEnable = new KComboBox( FALSE, m_controlsBox, "m_comboEnable" );
00080
00081 m_controlsBoxLayout->addWidget( m_comboEnable, 1, 2 );
00082
00083 m_comboDisable = new KComboBox( FALSE, m_controlsBox, "m_comboDisable" );
00084
00085 m_controlsBoxLayout->addWidget( m_comboDisable, 2, 2 );
00086 KNotifyWidgetBaseLayout->addWidget( m_controlsBox );
00087
00088 m_actionsBox = new QGroupBox( this, "m_actionsBox" );
00089 m_actionsBox->setColumnLayout(0, Qt::Vertical );
00090 m_actionsBox->layout()->setSpacing( KDialog::spacingHint() );
00091 m_actionsBox->layout()->setMargin( KDialog::marginHint() );
00092 m_actionsBoxLayout = new QGridLayout( m_actionsBox->layout() );
00093 m_actionsBoxLayout->setAlignment( Qt::AlignTop );
00094
00095 m_stderr = new QCheckBox( m_actionsBox, "m_stderr" );
00096
00097 m_actionsBoxLayout->addMultiCellWidget( m_stderr, 5, 5, 0, 2 );
00098
00099 m_messageBox = new QCheckBox( m_actionsBox, "m_messageBox" );
00100
00101 m_actionsBoxLayout->addMultiCellWidget( m_messageBox, 3, 3, 0, 2 );
00102
00103 m_execute = new QCheckBox( m_actionsBox, "m_execute" );
00104
00105 m_actionsBoxLayout->addMultiCellWidget( m_execute, 2, 2, 0, 1 );
00106
00107 Layout25 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout25");
00108
00109 m_playSound = new QCheckBox( m_actionsBox, "m_playSound" );
00110 Layout25->addWidget( m_playSound );
00111
00112 m_playButton = new QPushButton( m_actionsBox, "m_playButton" );
00113 Layout25->addWidget( m_playButton );
00114
00115 m_actionsBoxLayout->addMultiCellLayout( Layout25, 0, 0, 0, 1 );
00116
00117 m_taskbar = new QCheckBox( m_actionsBox, "m_taskbar" );
00118
00119 m_actionsBoxLayout->addMultiCellWidget( m_taskbar, 6, 6, 0, 2 );
00120
00121 m_logToFile = new QCheckBox( m_actionsBox, "m_logToFile" );
00122
00123 m_actionsBoxLayout->addMultiCellWidget( m_logToFile, 1, 1, 0, 1 );
00124 Spacer3 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
00125 m_actionsBoxLayout->addItem( Spacer3, 4, 0 );
00126
00127 m_executePath = new KURLRequester( m_actionsBox, "m_executePath" );
00128 m_executePath->setEnabled( FALSE );
00129 m_executePath->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, m_executePath->sizePolicy().hasHeightForWidth() ) );
00130
00131 m_actionsBoxLayout->addWidget( m_executePath, 2, 2 );
00132
00133 m_logfilePath = new KURLRequester( m_actionsBox, "m_logfilePath" );
00134 m_logfilePath->setEnabled( FALSE );
00135 m_logfilePath->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, m_logfilePath->sizePolicy().hasHeightForWidth() ) );
00136
00137 m_actionsBoxLayout->addWidget( m_logfilePath, 1, 2 );
00138
00139 m_soundPath = new KURLRequester( m_actionsBox, "m_soundPath" );
00140 m_soundPath->setEnabled( FALSE );
00141 m_soundPath->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, m_soundPath->sizePolicy().hasHeightForWidth() ) );
00142
00143 m_actionsBoxLayout->addWidget( m_soundPath, 0, 2 );
00144
00145 m_passivePopup = new QCheckBox( m_actionsBox, "m_passivePopup" );
00146 m_passivePopup->setEnabled( FALSE );
00147
00148 m_actionsBoxLayout->addMultiCellWidget( m_passivePopup, 4, 4, 1, 2 );
00149 KNotifyWidgetBaseLayout->addWidget( m_actionsBox );
00150
00151 Layout8 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "Layout8");
00152
00153 m_extension = new QPushButton( this, "m_extension" );
00154 m_extension->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)4, (QSizePolicy::SizeType)0, 0, 0, m_extension->sizePolicy().hasHeightForWidth() ) );
00155 m_extension->setToggleButton( FALSE );
00156 Layout8->addWidget( m_extension );
00157 Spacer7 = new QSpacerItem( 20, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
00158 Layout8->addItem( Spacer7 );
00159
00160 m_playerButton = new QPushButton( this, "m_playerButton" );
00161 Layout8->addWidget( m_playerButton );
00162 KNotifyWidgetBaseLayout->addLayout( Layout8 );
00163 languageChange();
00164 resize( QSize(487, 531).expandedTo(minimumSizeHint()) );
00165 clearWState( WState_Polished );
00166
00167
00168 connect( m_messageBox, SIGNAL( toggled(bool) ), m_passivePopup, SLOT( setEnabled(bool) ) );
00169 connect( m_execute, SIGNAL( toggled(bool) ), m_executePath, SLOT( setEnabled(bool) ) );
00170 connect( m_playSound, SIGNAL( toggled(bool) ), m_soundPath, SLOT( setEnabled(bool) ) );
00171 connect( m_logToFile, SIGNAL( toggled(bool) ), m_logfilePath, SLOT( setEnabled(bool) ) );
00172
00173
00174 setTabOrder( m_listview, m_playSound );
00175 setTabOrder( m_playSound, m_playButton );
00176 setTabOrder( m_playButton, m_soundPath );
00177 setTabOrder( m_soundPath, m_logToFile );
00178 setTabOrder( m_logToFile, m_logfilePath );
00179 setTabOrder( m_logfilePath, m_execute );
00180 setTabOrder( m_execute, m_executePath );
00181 setTabOrder( m_executePath, m_messageBox );
00182 setTabOrder( m_messageBox, m_passivePopup );
00183 setTabOrder( m_passivePopup, m_stderr );
00184 setTabOrder( m_stderr, m_affectAllApps );
00185 setTabOrder( m_affectAllApps, m_buttonEnable );
00186 setTabOrder( m_buttonEnable, m_comboEnable );
00187 setTabOrder( m_comboEnable, m_buttonDisable );
00188 setTabOrder( m_buttonDisable, m_comboDisable );
00189 setTabOrder( m_comboDisable, m_extension );
00190 setTabOrder( m_extension, m_playerButton );
00191 }
00192
00193
00194
00195
00196 KNotifyWidgetBase::~KNotifyWidgetBase()
00197 {
00198
00199 }
00200
00201
00202
00203
00204
00205 void KNotifyWidgetBase::languageChange()
00206 {
00207 m_listview->header()->setLabel( 0, QString::null );
00208 m_listview->header()->setLabel( 1, QString::null );
00209 m_listview->header()->setLabel( 2, QString::null );
00210 m_listview->header()->setLabel( 3, QString::null );
00211 m_listview->header()->setLabel( 4, QString::null );
00212 m_listview->header()->setLabel( 5, QString::null );
00213 m_listview->header()->setLabel( 6, tr2i18n( "Events" ) );
00214 m_controlsBox->setTitle( tr2i18n( "Quick Controls" ) );
00215 m_affectAllApps->setText( tr2i18n( "Apply to &all applications" ) );
00216 m_buttonDisable->setText( tr2i18n( "Turn O&ff All" ) );
00217 QToolTip::add( m_buttonDisable, tr2i18n( "Allows you to change the behavior for all events at once" ) );
00218 m_buttonEnable->setText( tr2i18n( "Turn O&n All" ) );
00219 QToolTip::add( m_buttonEnable, tr2i18n( "Allows you to change the behavior for all events at once" ) );
00220 m_actionsBox->setTitle( tr2i18n( "Actions" ) );
00221 m_stderr->setText( tr2i18n( "Print a message to standard &error output" ) );
00222 m_messageBox->setText( tr2i18n( "Show a &message in a pop-up window" ) );
00223 m_execute->setText( tr2i18n( "E&xecute a program:" ) );
00224 m_playSound->setText( tr2i18n( "Play a &sound:" ) );
00225 m_playButton->setText( QString::null );
00226 QToolTip::add( m_playButton, tr2i18n( "Test the Sound" ) );
00227 m_taskbar->setText( tr2i18n( "Mark &taskbar entry" ) );
00228 m_logToFile->setText( tr2i18n( "&Log to a file:" ) );
00229 m_passivePopup->setText( tr2i18n( "&Use a passive window that does not interrupt other work" ) );
00230 m_extension->setText( tr2i18n( "Less Options" ) );
00231 m_playerButton->setText( tr2i18n( "Player Settings" ) );
00232 }
00233
00234 #include "knotifywidgetbase.moc"