kshortcutdialog_advanced.cpp

00001 #include <kdialog.h>
00002 #include <klocale.h>
00003 /****************************************************************************
00004 ** Form implementation generated from reading ui file './kshortcutdialog_advanced.ui'
00005 **
00006 ** Created by: The User Interface Compiler ($Id: qt/main.cpp   3.3.6   edited Aug 31 2005 $)
00007 **
00008 ** WARNING! All changes made in this file will be lost!
00009 ****************************************************************************/
00010 
00011 #include "kshortcutdialog_advanced.h"
00012 
00013 #include <qvariant.h>
00014 #include <kpushbutton.h>
00015 #include <qpushbutton.h>
00016 #include <qbuttongroup.h>
00017 #include <qradiobutton.h>
00018 #include <qcheckbox.h>
00019 #include <qlayout.h>
00020 #include <qtooltip.h>
00021 #include <qwhatsthis.h>
00022 #include "kpushbutton.h"
00023 
00024 /*
00025  *  Constructs a KShortcutDialogAdvanced as a child of 'parent', with the
00026  *  name 'name' and widget flags set to 'f'.
00027  */
00028 KShortcutDialogAdvanced::KShortcutDialogAdvanced( QWidget* parent, const char* name, WFlags fl )
00029     : QWidget( parent, name, fl )
00030 {
00031     if ( !name )
00032     setName( "KShortcutDialogAdvanced" );
00033     setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, sizePolicy().hasHeightForWidth() ) );
00034     KShortcutDialogAdvancedLayout = new QVBoxLayout( this, 0, KDialog::spacingHint(), "KShortcutDialogAdvancedLayout"); 
00035 
00036     m_frameMore = new QButtonGroup( this, "m_frameMore" );
00037     m_frameMore->setFrameShape( QButtonGroup::NoFrame );
00038     m_frameMore->setFrameShadow( QButtonGroup::Plain );
00039     m_frameMore->setColumnLayout(0, Qt::Vertical );
00040     m_frameMore->layout()->setSpacing( KDialog::spacingHint() );
00041     m_frameMore->layout()->setMargin( 0 );
00042     m_frameMoreLayout = new QGridLayout( m_frameMore->layout() );
00043     m_frameMoreLayout->setAlignment( Qt::AlignTop );
00044 
00045     m_btnAlternate = new QRadioButton( m_frameMore, "m_btnAlternate" );
00046     m_btnAlternate->setFocusPolicy( QRadioButton::NoFocus );
00047 
00048     m_frameMoreLayout->addWidget( m_btnAlternate, 1, 0 );
00049 
00050     m_btnPrimary = new QRadioButton( m_frameMore, "m_btnPrimary" );
00051     m_btnPrimary->setFocusPolicy( QRadioButton::NoFocus );
00052 
00053     m_frameMoreLayout->addWidget( m_btnPrimary, 0, 0 );
00054 
00055     layout6 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "layout6"); 
00056 
00057     m_txtAlternate = new KPushButton( m_frameMore, "m_txtAlternate" );
00058     m_txtAlternate->setPaletteBackgroundColor( QColor( 255, 255, 255 ) );
00059     m_txtAlternate->setFocusPolicy( KPushButton::ClickFocus );
00060     m_txtAlternate->setAutoDefault( FALSE );
00061     m_txtAlternate->setDefault( FALSE );
00062     layout6->addWidget( m_txtAlternate );
00063     spacer6 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00064     layout6->addItem( spacer6 );
00065 
00066     m_frameMoreLayout->addLayout( layout6, 1, 2 );
00067 
00068     layout7 = new QHBoxLayout( 0, 0, KDialog::spacingHint(), "layout7"); 
00069 
00070     m_txtPrimary = new KPushButton( m_frameMore, "m_txtPrimary" );
00071     m_txtPrimary->setPaletteBackgroundColor( QColor( 255, 255, 255 ) );
00072     m_txtPrimary->setCursor( QCursor( 4 ) );
00073     m_txtPrimary->setFocusPolicy( KPushButton::ClickFocus );
00074     m_txtPrimary->setAutoDefault( FALSE );
00075     layout7->addWidget( m_txtPrimary );
00076     spacer5 = new QSpacerItem( 21, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00077     layout7->addItem( spacer5 );
00078 
00079     m_frameMoreLayout->addLayout( layout7, 0, 2 );
00080 
00081     m_btnClearPrimary = new QPushButton( m_frameMore, "m_btnClearPrimary" );
00082     m_btnClearPrimary->setFlat( TRUE );
00083 
00084     m_frameMoreLayout->addWidget( m_btnClearPrimary, 0, 1 );
00085 
00086     m_btnClearAlternate = new QPushButton( m_frameMore, "m_btnClearAlternate" );
00087     m_btnClearAlternate->setFlat( TRUE );
00088 
00089     m_frameMoreLayout->addWidget( m_btnClearAlternate, 1, 1 );
00090 
00091     m_btnMultiKey = new QCheckBox( m_frameMore, "m_btnMultiKey" );
00092     m_btnMultiKey->setFocusPolicy( QCheckBox::NoFocus );
00093 
00094     m_frameMoreLayout->addWidget( m_btnMultiKey, 2, 0 );
00095     KShortcutDialogAdvancedLayout->addWidget( m_frameMore );
00096     languageChange();
00097     resize( QSize(359, 157).expandedTo(minimumSizeHint()) );
00098     clearWState( WState_Polished );
00099 
00100     // signals and slots connections
00101     connect( m_txtPrimary, SIGNAL( clicked() ), m_btnPrimary, SLOT( animateClick() ) );
00102     connect( m_txtAlternate, SIGNAL( clicked() ), m_btnAlternate, SLOT( animateClick() ) );
00103 }
00104 
00105 /*
00106  *  Destroys the object and frees any allocated resources
00107  */
00108 KShortcutDialogAdvanced::~KShortcutDialogAdvanced()
00109 {
00110     // no need to delete child widgets, Qt does it all for us
00111 }
00112 
00113 /*
00114  *  Sets the strings of the subwidgets using the current
00115  *  language.
00116  */
00117 void KShortcutDialogAdvanced::languageChange()
00118 {
00119     m_frameMore->setTitle( QString::null );
00120     m_btnAlternate->setText( tr2i18n( "Alternate shortcut:" ) );
00121     m_btnPrimary->setText( tr2i18n( "Primary shortcut:" ) );
00122     m_txtAlternate->setText( QString::null );
00123     m_txtPrimary->setText( QString::null );
00124     QWhatsThis::add( m_txtPrimary, tr2i18n( "The currently set shortcut or the shortcut you are entering will show up here." ) );
00125     m_btnClearPrimary->setText( tr2i18n( "x" ) );
00126     QToolTip::add( m_btnClearPrimary, tr2i18n( "Clear shortcut" ) );
00127     m_btnClearAlternate->setText( tr2i18n( "x" ) );
00128     QToolTip::add( m_btnClearAlternate, tr2i18n( "Clear shortcut" ) );
00129     m_btnMultiKey->setText( tr2i18n( "Multi-key mode" ) );
00130     QToolTip::add( m_btnMultiKey, tr2i18n( "Enable the entry of multi-key shortcuts" ) );
00131     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." ) );
00132 }
00133 
00134 #include "kshortcutdialog_advanced.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys