00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "kshortcutdialog_advanced.h"
00013
00014 #include <qvariant.h>
00015 #include <kpushbutton.h>
00016 #include <qpushbutton.h>
00017 #include <qbuttongroup.h>
00018 #include <qradiobutton.h>
00019 #include <qcheckbox.h>
00020 #include <qlayout.h>
00021 #include <qtooltip.h>
00022 #include <qwhatsthis.h>
00023 #include "kpushbutton.h"
00024
00025
00026
00027
00028
00029 KShortcutDialogAdvanced::KShortcutDialogAdvanced( QWidget* parent, const char* name, WFlags fl )
00030 : QWidget( parent, name, fl )
00031 {
00032 if ( !name )
00033 setName( "KShortcutDialogAdvanced" );
00034 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, sizePolicy().hasHeightForWidth() ) );
00035 KShortcutDialogAdvancedLayout = new QVBoxLayout( this, 0, KDialog::spacingHint(), "KShortcutDialogAdvancedLayout");
00036
00037 m_frameMore = new QButtonGroup( this, "m_frameMore" );
00038 m_frameMore->setFrameShape( QButtonGroup::NoFrame );
00039 m_frameMore->setFrameShadow( QButtonGroup::Plain );
00040 m_frameMore->setColumnLayout(0, Qt::Vertical );
00041 m_frameMore->layout()->setSpacing( KDialog::spacingHint() );
00042 m_frameMore->layout()->setMargin( 0 );
00043 m_frameMoreLayout = new QGridLayout( m_frameMore->layout() );
00044 m_frameMoreLayout->setAlignment( Qt::AlignTop );
00045
00046 m_btnAlternate = new QRadioButton( m_frameMore, "m_btnAlternate" );
00047 m_btnAlternate->setFocusPolicy( QRadioButton::NoFocus );
00048
00049 m_frameMoreLayout->addWidget( m_btnAlternate, 1, 0 );
00050
00051 m_btnPrimary = new QRadioButton( m_frameMore, "m_btnPrimary" );
00052 m_btnPrimary->setFocusPolicy( QRadioButton::NoFocus );
00053
00054 m_frameMoreLayout->addWidget( m_btnPrimary, 0, 0 );
00055
00056 layout6 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "layout6");
00057
00058 m_txtAlternate = new KPushButton( m_frameMore, "m_txtAlternate" );
00059 m_txtAlternate->setPaletteBackgroundColor( QColor( 255, 255, 255 ) );
00060 m_txtAlternate->setFocusPolicy( KPushButton::ClickFocus );
00061 m_txtAlternate->setAutoDefault( FALSE );
00062 m_txtAlternate->setDefault( FALSE );
00063 layout6->addWidget( m_txtAlternate );
00064 spacer6 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00065 layout6->addItem( spacer6 );
00066
00067 m_frameMoreLayout->addLayout( layout6, 1, 2 );
00068
00069 layout7 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "layout7");
00070
00071 m_txtPrimary = new KPushButton( m_frameMore, "m_txtPrimary" );
00072 m_txtPrimary->setPaletteBackgroundColor( QColor( 255, 255, 255 ) );
00073 m_txtPrimary->setCursor( QCursor( 4 ) );
00074 m_txtPrimary->setFocusPolicy( KPushButton::ClickFocus );
00075 m_txtPrimary->setAutoDefault( FALSE );
00076 layout7->addWidget( m_txtPrimary );
00077 spacer5 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00078 layout7->addItem( spacer5 );
00079
00080 m_frameMoreLayout->addLayout( layout7, 0, 2 );
00081
00082 m_btnClearPrimary = new QPushButton( m_frameMore, "m_btnClearPrimary" );
00083 m_btnClearPrimary->setFlat( TRUE );
00084
00085 m_frameMoreLayout->addWidget( m_btnClearPrimary, 0, 1 );
00086
00087 m_btnClearAlternate = new QPushButton( m_frameMore, "m_btnClearAlternate" );
00088 m_btnClearAlternate->setFlat( TRUE );
00089
00090 m_frameMoreLayout->addWidget( m_btnClearAlternate, 1, 1 );
00091
00092 m_btnMultiKey = new QCheckBox( m_frameMore, "m_btnMultiKey" );
00093 m_btnMultiKey->setFocusPolicy( QCheckBox::NoFocus );
00094
00095 m_frameMoreLayout->addWidget( m_btnMultiKey, 2, 0 );
00096 KShortcutDialogAdvancedLayout->addWidget( m_frameMore );
00097 languageChange();
00098 resize( QSize(359, 157).expandedTo(minimumSizeHint()) );
00099 clearWState( WState_Polished );
00100
00101
00102 connect( m_txtPrimary, SIGNAL( clicked() ), m_btnPrimary, SLOT( animateClick() ) );
00103 connect( m_txtAlternate, SIGNAL( clicked() ), m_btnAlternate, SLOT( animateClick() ) );
00104 }
00105
00106
00107
00108
00109 KShortcutDialogAdvanced::~KShortcutDialogAdvanced()
00110 {
00111
00112 }
00113
00114
00115
00116
00117
00118 void KShortcutDialogAdvanced::languageChange()
00119 {
00120 m_frameMore->setTitle( QString::null );
00121 m_btnAlternate->setText( tr2i18n( "Alternate shortcut:" ) );
00122 m_btnPrimary->setText( tr2i18n( "Primary shortcut:" ) );
00123 m_txtAlternate->setText( QString::null );
00124 m_txtPrimary->setText( QString::null );
00125 QWhatsThis::add( m_txtPrimary, tr2i18n( "The currently set shortcut or the shortcut you are entering will show up here." ) );
00126 m_btnClearPrimary->setText( tr2i18n( "x" ) );
00127 QToolTip::add( m_btnClearPrimary, tr2i18n( "Clear shortcut" ) );
00128 m_btnClearAlternate->setText( tr2i18n( "x" ) );
00129 QToolTip::add( m_btnClearAlternate, tr2i18n( "Clear shortcut" ) );
00130 m_btnMultiKey->setText( tr2i18n( "Multi-key mode" ) );
00131 QToolTip::add( m_btnMultiKey, tr2i18n( "Enable the entry of multi-key shortcuts" ) );
00132 QWhatsThis::add( m_btnMultiKey, tr2i18n( "Select this checkbox to enable the entry of multi-key shortcuts. A multi-key shortcut consists of a sequence of up to 4 keys. For example, you could assign \"Ctrl+F,B\" to Font-Bold and \"Ctrl+F,U\" to Font-Underline." ) );
00133 }
00134
00135 #include "kshortcutdialog_advanced.moc"