knotes Library API Documentation

knoteconfigdlg.cpp

00001 /******************************************************************* 00002 KNotes -- Notes for the KDE project 00003 00004 Copyright (c) 1997-2004, The KNotes Developers 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 *******************************************************************/ 00020 00021 #include <qlabel.h> 00022 #include <qlayout.h> 00023 #include <qcheckbox.h> 00024 00025 #include <kconfig.h> 00026 #include <klocale.h> 00027 #include <kiconloader.h> 00028 #include <kcolorbutton.h> 00029 #include <knuminput.h> 00030 #include <klineedit.h> 00031 #include <kfontrequester.h> 00032 #include <kseparator.h> 00033 00034 #include "knote.h" 00035 #include "knoteconfig.h" 00036 #include "knoteconfigdlg.h" 00037 #include "version.h" 00038 00039 00040 KNoteConfigDlg::KNoteConfigDlg( KNoteConfig *config, const QString& title, 00041 bool defaults, QWidget *parent, const char *name ) 00042 : KConfigDialog( parent, name, config, IconList, 00043 defaults ? Default|Ok|Cancel : Default|Ok|Apply|Cancel, Ok ) 00044 { 00045 setCaption( title ); 00046 setIcon( SmallIcon( "knotes" ) ); 00047 00048 setIconListAllVisible( true ); 00049 00050 config->readConfig(); 00051 config->setVersion( KNOTES_VERSION ); 00052 00053 makeDisplayPage( defaults ); 00054 makeEditorPage(); 00055 makeActionsPage(); 00056 } 00057 00058 KNoteConfigDlg::~KNoteConfigDlg() 00059 { 00060 } 00061 00062 void KNoteConfigDlg::slotUpdateCaption() 00063 { 00064 KNote *note = ::qt_cast<KNote *>(sender()); 00065 if ( note ) 00066 setCaption( note->name() ); 00067 } 00068 00069 void KNoteConfigDlg::makeDisplayPage( bool defaults ) 00070 { 00071 QWidget *displayPage = new QWidget(); 00072 QGridLayout *layout = new QGridLayout( displayPage, 6, 2, 0, spacingHint() ); 00073 00074 QLabel *label_FgColor = new QLabel( i18n("&Text color:"), displayPage, "label_FgColor" ); 00075 layout->addWidget( label_FgColor, 0, 0 ); 00076 00077 QLabel *label_BgColor = new QLabel( i18n("&Background color:"), displayPage, "label_BgColor" ); 00078 layout->addWidget( label_BgColor, 1, 0 ); 00079 00080 KColorButton *kcfg_FgColor = new KColorButton( displayPage, "kcfg_FgColor" ); 00081 label_FgColor->setBuddy( kcfg_FgColor ); 00082 layout->addWidget( kcfg_FgColor, 0, 1 ); 00083 00084 KColorButton *kcfg_BgColor = new KColorButton( displayPage, "kcfg_BgColor" ); 00085 label_BgColor->setBuddy( kcfg_BgColor ); 00086 layout->addWidget( kcfg_BgColor, 1, 1 ); 00087 00088 QCheckBox *kcfg_ShowInTaskbar = new QCheckBox( i18n("&Show note in taskbar"), 00089 displayPage, "kcfg_ShowInTaskbar" ); 00090 layout->addWidget( kcfg_ShowInTaskbar, 4, 0 ); 00091 00092 00093 if ( defaults ) 00094 { 00095 QLabel *label_Width = new QLabel( i18n("Default &width:"), displayPage, "label_Width" ); 00096 layout->addWidget( label_Width, 2, 0 ); 00097 00098 QLabel *label_Height = new QLabel( i18n("Default &height:"), displayPage, "label_Height" ); 00099 layout->addWidget( label_Height, 3, 0 ); 00100 00101 KIntNumInput *kcfg_Width = new KIntNumInput( displayPage, "kcfg_Width" ); 00102 label_Width->setBuddy( kcfg_Width ); 00103 kcfg_Width->setRange( 100, 2000, 10, false ); 00104 layout->addWidget( kcfg_Width, 2, 1 ); 00105 00106 KIntNumInput *kcfg_Height = new KIntNumInput( displayPage, "kcfg_Height" ); 00107 kcfg_Height->setRange( 100, 2000, 10, false ); 00108 label_Height->setBuddy( kcfg_Height ); 00109 layout->addWidget( kcfg_Height, 3, 1 ); 00110 } 00111 00112 KSeparator *separator = new KSeparator( Horizontal, displayPage ); 00113 layout->addMultiCellWidget( separator, 5, 5, 0, 1 ); 00114 00115 addPage( displayPage, i18n("Display"), "knotes", i18n("Display Settings") ); 00116 } 00117 00118 void KNoteConfigDlg::makeEditorPage() 00119 { 00120 QWidget *editorPage = new QWidget(); 00121 QGridLayout *layout = new QGridLayout( editorPage, 4, 3, 0, spacingHint() ); 00122 00123 QLabel *label_TabSize = new QLabel( i18n( "&Tab size:" ), editorPage, "label_TabSize" ); 00124 layout->addMultiCellWidget( label_TabSize, 0, 0, 0, 1 ); 00125 00126 KIntNumInput *kcfg_TabSize = new KIntNumInput( editorPage, "kcfg_TabSize" ); 00127 kcfg_TabSize->setRange( 0, 40, 1, false ); 00128 label_TabSize->setBuddy( kcfg_TabSize ); 00129 layout->addWidget( kcfg_TabSize, 0, 2 ); 00130 00131 QCheckBox *kcfg_AutoIndent = new QCheckBox( i18n("Auto &indent"), editorPage, "kcfg_AutoIndent" ); 00132 layout->addMultiCellWidget( kcfg_AutoIndent, 1, 1, 0, 1 ); 00133 00134 QCheckBox *kcfg_RichText = new QCheckBox( i18n("&Rich text"), editorPage, "kcfg_RichText" ); 00135 layout->addWidget( kcfg_RichText, 1, 2 ); 00136 00137 QLabel *label_Font = new QLabel( i18n("Text font:"), editorPage, "label_Font" ); 00138 layout->addWidget( label_Font, 3, 0 ); 00139 00140 KFontRequester *kcfg_Font = new KFontRequester( editorPage, "kcfg_Font" ); 00141 layout->addMultiCellWidget( kcfg_Font, 3, 3, 1, 2 ); 00142 00143 QLabel *label_TitleFont = new QLabel( i18n("Title font:"), editorPage, "label_TitleFont" ); 00144 layout->addWidget( label_TitleFont, 2, 0 ); 00145 00146 KFontRequester *kcfg_TitleFont = new KFontRequester( editorPage, "kcfg_TitleFont" ); 00147 layout->addMultiCellWidget( kcfg_TitleFont, 2, 2, 1, 2 ); 00148 00149 KSeparator *separator = new KSeparator( Horizontal, editorPage ); 00150 layout->addMultiCellWidget( separator, 4, 4, 0, 2 ); 00151 00152 addPage( editorPage, i18n( "Editor" ), "edit", i18n("Editor Settings") ); 00153 } 00154 00155 void KNoteConfigDlg::makeActionsPage() 00156 { 00157 QWidget *actionsPage = new QWidget(); 00158 QGridLayout *layout = new QGridLayout( actionsPage, 2, 2, 0, spacingHint() ); 00159 00160 QLabel *label_MailAction = new QLabel( i18n("&Mail action:"), actionsPage, "label_MailAction" ); 00161 layout->addWidget( label_MailAction, 0, 0 ); 00162 00163 KLineEdit *kcfg_MailAction = new KLineEdit( actionsPage, "kcfg_MailAction" ); 00164 label_MailAction->setBuddy( kcfg_MailAction ); 00165 layout->addWidget( kcfg_MailAction, 0, 1 ); 00166 00167 KSeparator *separator = new KSeparator( Horizontal, actionsPage ); 00168 layout->addMultiCellWidget( separator, 2, 2, 0, 1 ); 00169 00170 addPage( actionsPage, i18n( "Actions" ), "misc", i18n("Action Settings") ); 00171 } 00172 00173 00174 #include "knoteconfigdlg.moc"
KDE Logo
This file is part of the documentation for knotes Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:45 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003