41 #include <tqvgroupbox.h>
42 #include <tqwhatsthis.h>
44 #include <kkeybutton.h>
45 #include <tdelocale.h>
46 #include <tdemessagebox.h>
48 #include "kmmainwidget.h"
49 #include "foldershortcutdialog.h"
52 using namespace KMail;
54 FolderShortcutDialog::FolderShortcutDialog( KMFolder *folder,
55 KMMainWidget *mainwidget,
58 : KDialogBase( parent, name, true,
59 i18n( "Shortcut for Folder %1" ).arg( folder->label() ),
60 KDialogBase:: Ok | KDialogBase::Cancel ),
61 mFolder( folder ), mMainWidget( mainwidget )
63 TQVBox *box = makeVBoxMainWidget();
64 TQVGroupBox *gb = new TQVGroupBox( i18n( "Select Shortcut for Folder"), box );
65 TQWhatsThis::add( gb, i18n( "<qt>To choose a key or a combination "
66 "of keys which select the current folder, "
67 "click the button below and then press the key(s) "
68 "you wish to associate with this folder.</qt>" ) );
69 TQHBox *hb = new TQHBox( gb );
71 mKeyButton = new KKeyButton( hb, "FolderShortcutSelector" );
74 connect( mKeyButton, TQ_SIGNAL( capturedShortcut( const TDEShortcut& ) ),
75 this, TQ_SLOT( slotCapturedShortcut( const TDEShortcut& ) ) );
76 mKeyButton->setShortcut( folder->shortcut(), false );
79 FolderShortcutDialog::~FolderShortcutDialog()
83 void FolderShortcutDialog::slotCapturedShortcut( const TDEShortcut& sc )
85 if ( sc == mKeyButton->shortcut() ) return;
86 if ( sc.toString().isNull() ) {
88 mKeyButton->setShortcut( TDEShortcut::null(), false );
90 if( !mMainWidget->shortcutIsValid( sc ) ) {
91 TQString msg( i18n( "The selected shortcut is already used, "
92 "please select a different one." ) );
93 KMessageBox::sorry( mMainWidget, msg );
95 mKeyButton->setShortcut( sc, false );
100 void FolderShortcutDialog::slotOk()
102 mFolder->setShortcut( mKeyButton->shortcut() );
103 KDialogBase::slotOk();
106 #include "foldershortcutdialog.moc"
@ Ok The user rights/ACL have been fetched from the server sucessfully.
|