Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

kateviewdialog.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kateviewdialog.cpp  -  description
00003                              -------------------
00004     copyright            : (C) 2001 by The Kate Team
00005                            (C) 2002 by Joseph Wenninger
00006     email                : kwrite-devel@kde.org
00007                            jowenn@kde.org
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 // Dialogs
00020 
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 
00024 #include <qgrid.h>
00025 #include <qlabel.h>
00026 #include <qlayout.h>
00027 #include <qlistbox.h>
00028 #include <qgroupbox.h>
00029 #include <qlineedit.h>
00030 #include <qcheckbox.h>
00031 #include <qcollection.h>
00032 #include <qpushbutton.h>
00033 #include <qobjectlist.h>
00034 #include <qradiobutton.h>
00035 #include <qwhatsthis.h>
00036 #include <qstringlist.h>
00037 #include <klocale.h>
00038 #include <kcolorbtn.h>
00039 #include <kglobal.h>
00040 #include <qvbox.h>
00041 #include <qspinbox.h>
00042 #include <qcombobox.h>
00043 #include <kfontdialog.h>
00044 
00045 #include "../document/katedocument.h"
00046 #include "kateviewdialog.h"
00047 #include <opie2/ofontselector.h>
00048 
00049 
00050 using namespace Opie::Ui;
00051 SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags )
00052   : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok )
00053   , m_replace( 0L )
00054 {
00055   QWidget *page = new QWidget( this );
00056   setMainWidget( page );
00057 
00058   QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
00059 
00060   m_search = new QComboBox( true, page );
00061   m_search->insertStringList( searchFor );
00062   m_search->setMinimumWidth( m_search->sizeHint().width() );
00063   m_search->lineEdit()->selectAll();
00064   QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page );
00065   m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page );
00066   topLayout->addWidget( label );
00067   topLayout->addWidget( m_search );
00068   topLayout->addWidget( m_optRegExp );
00069 
00070   if( flags & KateView::sfReplace )
00071   {
00072     // make it a replace dialog
00073     setCaption( i18n( "Replace Text" ) );
00074     m_replace = new QComboBox( true, page );
00075     m_replace->insertStringList( replaceWith );
00076     m_replace->setMinimumWidth( m_search->sizeHint().width() );
00077     label = new QLabel( m_replace, i18n( "&Replace With:" ), page );
00078     //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page );
00079     topLayout->addWidget( label );
00080     topLayout->addWidget( m_replace );
00081     //topLayout->addWidget( m_optPlaceholders );
00082   }
00083 
00084   QGroupBox *group = new QGroupBox( i18n( "Options" ), page );
00085   topLayout->addWidget( group, 10 );
00086 
00087   QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() );
00088   gbox->addRowSpacing( 0, fontMetrics().lineSpacing() );
00089   gbox->setRowStretch( 4, 10 );
00090 
00091   m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group );
00092   gbox->addWidget( m_opt1, 1, 0 );
00093 
00094   m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group );
00095   gbox->addWidget( m_opt2, 2, 0 );
00096 
00097   m_opt3 = new QCheckBox(i18n("&From Beginning" ), group );
00098   gbox->addWidget( m_opt3, 3, 0 );
00099 
00100   m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group );
00101   gbox->addWidget( m_opt4, 1, 1 );
00102 
00103   m_opt5 = new QCheckBox(i18n("&Selected Text" ), group );
00104   gbox->addWidget( m_opt5, 2, 1 );
00105 
00106   m_opt1->setChecked( flags & KateView::sfCaseSensitive );
00107   m_opt2->setChecked( flags & KateView::sfWholeWords );
00108   m_opt3->setChecked( flags & KateView::sfFromBeginning );
00109   m_optRegExp->setChecked( flags & KateView::sfRegularExpression );
00110   m_opt4->setChecked( flags & KateView::sfBackward );
00111   m_opt5->setChecked( flags & KateView::sfSelected );
00112 
00113   if( m_replace )
00114   {
00115     m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group );
00116     m_opt6->setChecked( flags & KateView::sfPrompt );
00117     gbox->addWidget( m_opt6, 3, 1 );
00118   }
00119 
00120   m_search->setFocus();
00121 }
00122 
00123 QString SearchDialog::getSearchFor()
00124 {
00125   return m_search->currentText();
00126 }
00127 
00128 QString SearchDialog::getReplaceWith()
00129 {
00130   return m_replace->currentText();
00131 }
00132 
00133 int SearchDialog::getFlags()
00134 {
00135   int flags = 0;
00136 
00137   if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive;
00138   if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords;
00139   if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning;
00140   if( m_opt4->isChecked() ) flags |= KateView::sfBackward;
00141   if( m_opt5->isChecked() ) flags |= KateView::sfSelected;
00142   if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression;
00143   if( m_replace )
00144   {
00145     if( m_opt6->isChecked() )
00146       flags |= KateView::sfPrompt;
00147 
00148     flags |= KateView::sfReplace;
00149   }
00150 
00151   return flags;
00152 }
00153 
00154 void SearchDialog::slotOk()
00155 {
00156   if ( !m_search->currentText().isEmpty() )
00157   {
00158     if ( !m_optRegExp->isChecked() )
00159     {
00160       accept();
00161     }
00162     else
00163     {
00164       // Check for a valid regular expression.
00165 
00166       QRegExp regExp( m_search->currentText() );
00167 
00168       if ( regExp.isValid() )
00169         accept();
00170     }
00171   }
00172 }
00173 
00174 void SearchDialog::setSearchText( const QString &searchstr )
00175  {
00176    m_search->insertItem( searchstr, 0 );
00177    m_search->setCurrentItem( 0 );
00178    m_search->lineEdit()->selectAll();
00179  }
00180 
00181 // this dialog is not modal
00182 ReplacePrompt::ReplacePrompt( QWidget *parent )
00183   : KDialogBase(parent, 0L, false, i18n( "Replace Text" ),
00184   User3 | User2 | User1 | Close, User3, true,
00185   i18n("&All"), i18n("&No"), i18n("&Yes")) {
00186 
00187   QWidget *page = new QWidget(this);
00188   setMainWidget(page);
00189 
00190   QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
00191   QLabel *label = new QLabel(i18n("Replace this occurrence?"),page);
00192   topLayout->addWidget(label );
00193 }
00194 
00195 void ReplacePrompt::slotUser1( void ) { // All
00196   done(KateView::srAll);
00197 }
00198 
00199 void ReplacePrompt::slotUser2( void ) { // No
00200   done(KateView::srNo);
00201 }
00202 
00203 void ReplacePrompt::slotUser3( void ) { // Yes
00204   accept();
00205 }
00206 
00207 void ReplacePrompt::done(int r) {
00208   setResult(r);
00209   emit clicked();
00210 }
00211 
00212 void ReplacePrompt::closeEvent(QCloseEvent *) {
00213   reject();
00214 }
00215 
00216 GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max)
00217   : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) {
00218 
00219   QWidget *page = new QWidget(this);
00220   setMainWidget(page);
00221 
00222   QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() );
00223   e1 = new QSpinBox(page);
00224   e1->setMinValue(1);
00225   e1->setMaxValue(max);
00226   e1->setValue((int)line);
00227 
00228   QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page );
00229   topLayout->addWidget(label);
00230   topLayout->addWidget(e1);
00231   topLayout->addSpacing(spacingHint()); // A little bit extra space
00232   topLayout->addStretch(10);
00233   e1->setFocus();
00234 }
00235 
00236 int GotoLineDialog::getLine() {
00237   return e1->value();
00238 }
00239 
00240 const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent,
00241   KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces};
00242 
00243 IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view)
00244   : QWidget(parent, 0L)
00245 {
00246   QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() );
00247   int configFlags = view->config();
00248 
00249   opt[0] = new QCheckBox(i18n("&Auto Indent"), this);
00250   layout->addWidget(opt[0], 0, AlignLeft);
00251   opt[0]->setChecked(configFlags & flags[0]);
00252 
00253   opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this);
00254   layout->addWidget(opt[1], 0, AlignLeft);
00255   opt[1]->setChecked(configFlags & flags[1]);
00256 
00257   opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this);
00258   layout->addWidget(opt[2], 0, AlignLeft);
00259   opt[2]->setChecked(configFlags & flags[2]);
00260 
00261   opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this);
00262   layout->addWidget(opt[3], 0, AlignLeft);
00263   opt[3]->setChecked(configFlags & flags[3]);
00264 
00265   opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this);
00266   layout->addWidget(opt[4], 0, AlignLeft);
00267 //  opt[4]->setChecked(configFlags & flags[4]);
00268   opt[4]->setChecked(true);
00269   opt[4]->hide();
00270 
00271   opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this);
00272   layout->addWidget(opt[5], 0, AlignLeft);
00273   opt[5]->setChecked(configFlags & flags[5]);
00274 
00275   layout->addStretch();
00276 
00277   // What is this? help
00278   QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used"));
00279   QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options"));
00280   QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent."));
00281   QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent."));
00282   QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents."));
00283   QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened."));
00284 }
00285 
00286 void IndentConfigTab::getData(KateView *view) {
00287   int configFlags, z;
00288 
00289   configFlags = view->config();
00290   for (z = 0; z < numFlags; z++) {
00291     configFlags &= ~flags[z];
00292     if (opt[z]->isChecked()) configFlags |= flags[z];
00293   }
00294   view->setConfig(configFlags);
00295 }
00296 
00297 const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput,
00298   KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect};
00299 
00300 SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view)
00301   : QWidget(parent, 0L)
00302 {
00303   QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() );
00304   int configFlags = view->config();
00305 
00306   opt[0] = new QCheckBox(i18n("&Persistent Selections"), this);
00307   layout->addWidget(opt[0], 0, AlignLeft);
00308   opt[0]->setChecked(configFlags & flags[0]);
00309 
00310   opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this);
00311   layout->addWidget(opt[1], 0, AlignLeft);
00312   opt[1]->setChecked(configFlags & flags[1]);
00313 
00314   opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this);
00315   layout->addWidget(opt[2], 0, AlignLeft);
00316   opt[2]->setChecked(configFlags & flags[2]);
00317 
00318   opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this);
00319   layout->addWidget(opt[3], 0, AlignLeft);
00320   opt[3]->setChecked(configFlags & flags[3]);
00321 
00322   opt[4] = new QCheckBox(i18n("&Vertical Selections"), this);
00323   layout->addWidget(opt[4], 0, AlignLeft);
00324   opt[4]->setChecked(configFlags & flags[4]);
00325 
00326   opt[5] = new QCheckBox(i18n("&Toggle Old"), this);
00327   layout->addWidget(opt[5], 0, AlignLeft);
00328   opt[5]->setChecked(configFlags & flags[5]);
00329 
00330   layout->addStretch();
00331 
00332   // What is this? help
00333   QWhatsThis::add(opt[0], i18n("Enabling this prevents key input or cursor movement by way of the arrow keys from causing the elimination of text selection.<p><b>Note:</b> If the Overwrite Selections option is activated then any typed character input or paste operation will replace the selected text."));
00334   QWhatsThis::add(opt[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text."));
00335   QWhatsThis::add(opt[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard."));
00336   QWhatsThis::add(opt[3], i18n("Not implemented yet."));
00337   QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections."));
00338   QWhatsThis::add(opt[5], i18n("Not yet implemented."));
00339 }
00340 
00341 void SelectConfigTab::getData(KateView *view) {
00342   int configFlags, z;
00343 
00344   configFlags = view->config();
00345   for (z = 0; z < numFlags; z++) {
00346     configFlags &= ~flags[z]; // clear flag
00347     if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked
00348   }
00349   view->setConfig(configFlags);
00350 }
00351 
00352 const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces,
00353   KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome,
00354   KateView::cfPageUDMovesCursor, KateView::cfWrapCursor};
00355 
00356 EditConfigTab::EditConfigTab(QWidget *parent, KateView *view)
00357   : QWidget(parent, 0L) {
00358 
00359   QHBoxLayout *mainLayout;
00360   QVBoxLayout *cbLayout, *leLayout;
00361   int configFlags;
00362 
00363   mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() );
00364 
00365   // checkboxes
00366   cbLayout = new QVBoxLayout( mainLayout );
00367   configFlags = view->config();
00368 
00369   opt[0] = new QCheckBox(i18n("&Word wrap"), this);
00370   cbLayout->addWidget(opt[0], 0, AlignLeft);
00371   opt[0]->setChecked(view->doc()->wordWrap());
00372 
00373   opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this);
00374   cbLayout->addWidget(opt[1], 0, AlignLeft);
00375   opt[1]->setChecked(configFlags & flags[1]);
00376 
00377   opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this);
00378   cbLayout->addWidget(opt[2], 0, AlignLeft);
00379   opt[2]->setChecked(configFlags & flags[2]);
00380 
00381   opt[3] = new QCheckBox(i18n("&Auto brackets"), this);
00382   cbLayout->addWidget(opt[3], 0, AlignLeft);
00383   opt[3]->setChecked(configFlags & flags[3]);
00384 
00385   opt[4] = new QCheckBox(i18n("Group &undos"), this);
00386   cbLayout->addWidget(opt[4], 0, AlignLeft);
00387   opt[4]->setChecked(configFlags & flags[4]);
00388 
00389   opt[5] = new QCheckBox(i18n("&Show tabs"), this);
00390   cbLayout->addWidget(opt[5], 0, AlignLeft);
00391   opt[5]->setChecked(configFlags & flags[5]);
00392 
00393   opt[6] = new QCheckBox(i18n("Smart &home"), this);
00394   cbLayout->addWidget(opt[6], 0, AlignLeft);
00395   opt[6]->setChecked(configFlags & flags[6]);
00396 
00397   opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this);
00398   cbLayout->addWidget(opt[7], 0, AlignLeft);
00399   opt[7]->setChecked(configFlags & flags[7]);
00400 
00401   opt[8] = new QCheckBox(i18n("Wrap &cursor"), this);
00402   cbLayout->addWidget(opt[8], 0, AlignLeft);
00403   opt[8]->setChecked(configFlags & flags[8]);
00404 
00405   cbLayout->addStretch();
00406 
00407   // edit lines
00408   leLayout = new QVBoxLayout();
00409   mainLayout->addLayout(leLayout,10);
00410 
00411   e1 = new QSpinBox(this);
00412   e1->setMinValue(20);
00413   e1->setMaxValue( 200);
00414   e1->setValue((int)(view->doc()->wordWrapAt()));
00415 #warning fixme  e1->setLabel(i18n("Wrap Words At:"));
00416 
00417   e2 = new QSpinBox(this);
00418   e2->setMinValue(1);
00419   e2->setMaxValue(16);
00420   e2->setValue((int)view->tabWidth());
00421 
00422 #warning fixme  e2->setLabel(i18n("Tab/Indent Width:"));
00423 
00424   e3 = new QSpinBox(this);
00425   e3->setMinValue(5);
00426   e3->setMaxValue( 30000);
00427 #warning fixme   e3->setLabel(i18n("Undo steps:"));
00428   e3->setValue((int)view->undoSteps());
00429 
00430   leLayout->addWidget(e1, 0, AlignLeft);
00431   leLayout->addWidget(e2, 0, AlignLeft);
00432   leLayout->addWidget(e3, 0, AlignLeft);
00433 
00434 
00435   QVBox *box = new QVBox (this);
00436   leLayout->addWidget (box, 0, AlignLeft);
00437 
00438   new QLabel (i18n("Encoding:"), box);
00439 
00440   encoding = new QComboBox(box);
00441 #warning fixme
00442 #if 0
00443   encoding->insertStringList (KGlobal::charsets()->availableEncodingNames());
00444   encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding()));
00445 #endif
00446   leLayout->addStretch();
00447 
00448   // What is this? help
00449   QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications."));
00450   QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line."));
00451   QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry."));
00452   QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs."));
00453   QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text."));
00454   QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor."));
00455   QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once."));
00456   QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text."));
00457   QWhatsThis::add(opt[6], i18n("Not yet implemented."));
00458   QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text."));
00459   QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory."));
00460   QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers."));
00461 }
00462 
00463 void EditConfigTab::getData(KateView *view)
00464 {
00465   int configFlags, z;
00466 
00467   configFlags = view->config();
00468   for (z = 1; z < numFlags; z++) {
00469     configFlags &= ~flags[z];
00470     if (opt[z]->isChecked()) configFlags |= flags[z];
00471   }
00472   view->setConfig(configFlags);
00473 
00474   view->setEncoding (encoding->currentText());
00475   view->doc()->setWordWrapAt(e1->value());
00476   view->doc()->setWordWrap (opt[0]->isChecked());
00477   view->setTabWidth(e2->value());
00478   view->setUndoSteps(e3->value());
00479 }
00480 
00481 ColorConfig::ColorConfig( QWidget *parent, char *name )
00482   : QWidget( parent, name )
00483 {
00484   QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint());
00485   glay->setColStretch(1,1);
00486   glay->setRowStretch(5,1);
00487 
00488   QLabel *label;
00489 
00490   label = new QLabel( i18n("Background:"), this);
00491   label->setAlignment( AlignRight|AlignVCenter );
00492   m_back = new KColorButton( this );
00493   glay->addWidget( label, 0, 0 );
00494   glay->addWidget( m_back, 0, 1 );
00495 
00496   label = new QLabel( i18n("Selected:"), this);
00497   label->setAlignment( AlignRight|AlignVCenter );
00498   m_selected = new KColorButton( this );
00499   glay->addWidget( label, 2, 0 );
00500   glay->addWidget( m_selected, 2, 1 );
00501 
00502   // QWhatsThis help
00503   QWhatsThis::add(m_back, i18n("Sets the background color of the editing area"));
00504   QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the &quot;<b>Configure Highlighting</b>&quot; dialog."));
00505 }
00506 
00507 
00508 ColorConfig::~ColorConfig()
00509 {
00510 }
00511 
00512 void ColorConfig::setColors(QColor *colors)
00513 {
00514   m_back->setColor( colors[0] );
00515   m_selected->setColor( colors[1] );
00516 }
00517 
00518 void ColorConfig::getColors(QColor *colors)
00519 {
00520   colors[0] = m_back->color();
00521   colors[1] = m_selected->color();
00522 }
00523 
00524 FontConfig::FontConfig( QWidget *parent, char *name )
00525   : QWidget( parent, name )
00526 {
00527     // sizemanagment
00528   QGridLayout *grid = new QGridLayout( this, 1, 1 );
00529 //     QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" );
00530 //     QString styleStr = cfg. readEntry ( "FontStyle", "Regular" );
00531 //     int size = cfg. readNumEntry ( "FontSize", 10 );
00532 //  OFontSelector *m_fontselect;
00533 
00534     m_fontselect = new OFontSelector ( false, this, "FontTab" );
00535 //    m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
00536 //   QWhatsThis::add( m_fontselect,
00537 //   tr( "Select the desired name, style and size of the default font applications will use." ) );
00538 
00539     connect( m_fontselect, SIGNAL( fontSelected(const QFont&)),
00540              this, SLOT( slotFontSelected(const QFont&)));
00541    grid->addWidget(  m_fontselect, 0, 0);
00542 
00543 
00544 // #if 0
00545 //   m_fontchooser = new KFontChooser ( this );
00546 //   m_fontchooser->enableColumn(KFontChooser::StyleList, false);
00547 //   grid->addWidget( m_fontchooser, 0, 0);
00548 
00549 //   connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&)));
00550 // #endif
00551 }
00552 
00553 FontConfig::~FontConfig()
00554 {
00555 }
00556 
00557 void FontConfig::setFont ( const QFont &font )
00558 {
00559 //#if 0
00560 m_fontselect->setFont (font);
00561   myFont = font;
00562 //#endif
00563 }
00564 
00565 void FontConfig::slotFontSelected( const QFont &font )
00566 {
00567   myFont = font;
00568 }
00569 
00570 
00571 
00572 

Generated on Sat Nov 5 16:17:14 2005 for OPIE by  doxygen 1.4.2