23#include <tqcheckbox.h> 
   24#include <tqcombobox.h> 
   25#include <tqhgroupbox.h> 
   26#include <tqtabwidget.h> 
   28#include <tdeapplication.h> 
   31#include <kiconloader.h> 
   32#include <kcolorbutton.h> 
   35#include <tdefontrequester.h> 
   39#include "knoteconfigdlg.h" 
   40#include "knotesglobalconfig.h" 
   44KNoteConfigDlg::KNoteConfigDlg( KNoteConfig *config, 
const TQString& title,
 
   45        TQWidget *parent, 
const char *name )
 
   46    : TDEConfigDialog( parent, name, config ? config : KNotesGlobalConfig::self(), IconList,
 
   47                     config ? Default|Ok|Apply|Cancel : Default|Ok|Cancel, Ok )
 
   50    KWin::setIcons( winId(), tdeApp->icon(), tdeApp->miniIcon() );
 
   52    setIconListAllVisible( 
true );
 
   53    enableButtonSeparator( 
true );
 
   57        addPage( makeDisplayPage( 
false ), i18n(
"Display"), 
"knotes",
 
   58                 i18n(
"Display Settings") );
 
   59        addPage( makeEditorPage( 
false ), i18n(
"Editor"), 
"edit",
 
   60                 i18n(
"Editor Settings") );
 
   64        config = KNotesGlobalConfig::self();
 
   65        addPage( makeDefaultsPage(), i18n(
"Defaults"), 
"knotes",
 
   66                 i18n(
"Default Settings for New Notes") );
 
   67        addPage( makeActionsPage(), i18n(
"Actions"), 
"misc",
 
   68                 i18n(
"Action Settings") );
 
   69        addPage( makeNetworkPage(), i18n(
"Network"), 
"network",
 
   70                 i18n(
"Network Settings") );
 
   71        addPage( makeStylePage(), i18n(
"Style"), 
"style",
 
   72                 i18n(
"Style Settings") );
 
   75    config->setVersion( KNOTES_VERSION );
 
   78KNoteConfigDlg::~KNoteConfigDlg()
 
   82void KNoteConfigDlg::slotUpdateCaption()
 
   84    KNote *note = ::tqt_cast<KNote *>(sender());
 
   86        setCaption( note->name() );
 
   89TQWidget *KNoteConfigDlg::makeDisplayPage( 
bool defaults )
 
   91    TQWidget *displayPage = 
new TQWidget();
 
   92    TQGridLayout *layout = 
new TQGridLayout( displayPage, 2, 2,
 
   93                                           defaults ? marginHint() : 0, spacingHint() );
 
   95    TQLabel *label_FgColor = 
new TQLabel( i18n(
"&Text color:"), displayPage, 
"label_FgColor" );
 
   96    layout->addWidget( label_FgColor, 0, 0 );
 
   98    KColorButton *kcfg_FgColor = 
new KColorButton( displayPage, 
"kcfg_FgColor" );
 
   99    label_FgColor->setBuddy( kcfg_FgColor );
 
  100    layout->addWidget( kcfg_FgColor, 0, 1 );
 
  102    TQLabel *label_BgColor = 
new TQLabel( i18n(
"&Background color:"), displayPage, 
"label_BgColor" );
 
  103    layout->addWidget( label_BgColor, 1, 0 );
 
  105    KColorButton *kcfg_BgColor = 
new KColorButton( displayPage, 
"kcfg_BgColor" );
 
  106    label_BgColor->setBuddy( kcfg_BgColor );
 
  107    layout->addWidget( kcfg_BgColor, 1, 1 );
 
  109    TQCheckBox *kcfg_ShowInTaskbar = 
new TQCheckBox( i18n(
"&Show note in taskbar"),
 
  110                                                   displayPage, 
"kcfg_ShowInTaskbar" );
 
  114        TQLabel *label_Width = 
new TQLabel( i18n(
"Default &width:"), displayPage, 
"label_Width" );
 
  115        layout->addWidget( label_Width, 2, 0 );
 
  117        KIntNumInput *kcfg_Width = 
new KIntNumInput( displayPage, 
"kcfg_Width" );
 
  118        label_Width->setBuddy( kcfg_Width );
 
  119        kcfg_Width->setRange( 50, 2000, 10, 
false );
 
  120        layout->addWidget( kcfg_Width, 2, 1 );
 
  122        TQLabel *label_Height = 
new TQLabel( i18n(
"Default &height:"), displayPage, 
"label_Height" );
 
  123        layout->addWidget( label_Height, 3, 0 );
 
  125        KIntNumInput *kcfg_Height = 
new KIntNumInput( displayPage, 
"kcfg_Height" );
 
  126        kcfg_Height->setRange( 50, 2000, 10, 
false );
 
  127        label_Height->setBuddy( kcfg_Height );
 
  128        layout->addWidget( kcfg_Height, 3, 1 );
 
  130        layout->addWidget( kcfg_ShowInTaskbar, 4, 0 );
 
  133        layout->addWidget( kcfg_ShowInTaskbar, 2, 0 );
 
  138TQWidget *KNoteConfigDlg::makeEditorPage( 
bool defaults )
 
  140    TQWidget *editorPage = 
new TQWidget();
 
  141    TQGridLayout *layout = 
new TQGridLayout( editorPage, 4, 3,
 
  142                                           defaults ? marginHint() : 0, spacingHint() );
 
  144    TQLabel *label_TabSize = 
new TQLabel( i18n( 
"&Tab size:" ), editorPage, 
"label_TabSize" );
 
  145    layout->addMultiCellWidget( label_TabSize, 0, 0, 0, 1 );
 
  147    KIntNumInput *kcfg_TabSize = 
new KIntNumInput( editorPage, 
"kcfg_TabSize" );
 
  148    kcfg_TabSize->setRange( 0, 40, 1, 
false );
 
  149    label_TabSize->setBuddy( kcfg_TabSize );
 
  150    layout->addWidget( kcfg_TabSize, 0, 2 );
 
  152    TQCheckBox *kcfg_AutoIndent = 
new TQCheckBox( i18n(
"Auto &indent"), editorPage, 
"kcfg_AutoIndent" );
 
  153    layout->addMultiCellWidget( kcfg_AutoIndent, 1, 1, 0, 1 );
 
  155    TQCheckBox *kcfg_RichText = 
new TQCheckBox( i18n(
"&Rich text"), editorPage, 
"kcfg_RichText" );
 
  156    layout->addWidget( kcfg_RichText, 1, 2 );
 
  158    TQLabel *label_Font = 
new TQLabel( i18n(
"Text font:"), editorPage, 
"label_Font" );
 
  159    layout->addWidget( label_Font, 3, 0 );
 
  161    TDEFontRequester *kcfg_Font = 
new TDEFontRequester( editorPage, 
"kcfg_Font" );
 
  162    kcfg_Font->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
 
  163    layout->addMultiCellWidget( kcfg_Font, 3, 3, 1, 2 );
 
  165    TQLabel *label_TitleFont = 
new TQLabel( i18n(
"Title font:"), editorPage, 
"label_TitleFont" );
 
  166    layout->addWidget( label_TitleFont, 2, 0 );
 
  168    TDEFontRequester *kcfg_TitleFont = 
new TDEFontRequester( editorPage, 
"kcfg_TitleFont" );
 
  169    kcfg_TitleFont->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) );
 
  170    layout->addMultiCellWidget( kcfg_TitleFont, 2, 2, 1, 2 );
 
  175TQWidget *KNoteConfigDlg::makeDefaultsPage()
 
  177    TQTabWidget *defaultsPage = 
new TQTabWidget();
 
  178    defaultsPage->addTab( makeDisplayPage( 
true ), SmallIconSet( 
"knotes" ), i18n(
"Displa&y") );
 
  179    defaultsPage->addTab( makeEditorPage( 
true ), SmallIconSet( 
"edit" ), i18n(
"&Editor") );
 
  184TQWidget *KNoteConfigDlg::makeActionsPage()
 
  186    TQWidget *actionsPage = 
new TQWidget();
 
  187    TQGridLayout *layout = 
new TQGridLayout( actionsPage, 2, 2, 0, spacingHint() );
 
  189    TQLabel *label_MailAction = 
new TQLabel( i18n(
"&Mail action:"), actionsPage, 
"label_MailAction" );
 
  190    layout->addWidget( label_MailAction, 0, 0 );
 
  192    KLineEdit *kcfg_MailAction = 
new KLineEdit( actionsPage, 
"kcfg_MailAction" );
 
  193    label_MailAction->setBuddy( kcfg_MailAction );
 
  194    layout->addWidget( kcfg_MailAction, 0, 1 );
 
  199TQWidget *KNoteConfigDlg::makeNetworkPage()
 
  201    TQWidget *networkPage = 
new TQWidget();
 
  202    TQGridLayout *layout = 
new TQGridLayout( networkPage, 4, 2, 0, spacingHint() );
 
  204    TQGroupBox *incoming = 
new TQHGroupBox( i18n(
"Incoming Notes"), networkPage );
 
  205    layout->addMultiCellWidget( incoming, 0, 0, 0, 1 );
 
  207    new TQCheckBox( i18n(
"Accept incoming notes"), incoming, 
"kcfg_ReceiveNotes" );
 
  209    TQGroupBox *outgoing = 
new TQHGroupBox( i18n(
"Outgoing Notes"), networkPage );
 
  210    layout->addMultiCellWidget( outgoing, 1, 1, 0, 1 );
 
  212    TQLabel *label_SenderID = 
new TQLabel( i18n(
"&Sender ID:"), outgoing, 
"label_SenderID" );
 
  213    KLineEdit *kcfg_SenderID = 
new KLineEdit( outgoing, 
"kcfg_SenderID" );
 
  214    label_SenderID->setBuddy( kcfg_SenderID );
 
  216    TQLabel *label_Port = 
new TQLabel( i18n(
"&Port:"), networkPage, 
"label_Port" );
 
  217    layout->addWidget( label_Port, 2, 0 );
 
  219    KIntNumInput *kcfg_Port = 
new KIntNumInput( networkPage, 
"kcfg_Port" );
 
  220    kcfg_Port->setRange( 0, 65535, 1, 
false );
 
  221    label_Port->setBuddy( kcfg_Port );
 
  222    layout->addWidget( kcfg_Port, 2, 1 );
 
  227TQWidget *KNoteConfigDlg::makeStylePage()
 
  229    TQWidget *stylePage = 
new TQWidget();
 
  230    TQGridLayout *layout = 
new TQGridLayout( stylePage, 2, 2, 0, spacingHint() );
 
  232    TQLabel *label_Style = 
new TQLabel( i18n(
"&Style:"), stylePage, 
"label_Style" );
 
  233    layout->addWidget( label_Style, 0, 0 );
 
  235    TQComboBox *kcfg_Style = 
new TQComboBox( stylePage, 
"kcfg_Style" );
 
  237    list << 
"Plain" << 
"Fancy";
 
  238    kcfg_Style->insertStringList( list );
 
  239    label_Style->setBuddy( kcfg_Style );
 
  240    layout->addWidget( kcfg_Style, 0, 1 );
 
  245#include "knoteconfigdlg.moc"