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

optionsDialog.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           optionsDialog.cpp  -  description
00003                              -------------------
00004     begin                : Tue Jul 25 2000
00005     copyright            : (C) 2000 -2004 by llornkcor
00006     email                : ljp@llornkcor.com
00007  ***************************************************************************/
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00017 
00018 #include "optionsDialog.h"
00019 #include "fontDialog.h"
00020 //#include "ftpsitedlg.h"
00021 //#include "browserDialog.h"
00022 //#define Inherited  QDialog
00023 
00024 /* OPIE */
00025 #include <opie2/odebug.h>
00026 #include <qpe/config.h>
00027 
00028 /* QT */
00029 #include <qfont.h>
00030 #include <qcheckbox.h>
00031 #include <qcombobox.h>
00032 #include <qlabel.h>
00033 #include <qlistbox.h>
00034 #include <qpushbutton.h>
00035 #include <qtabwidget.h>
00036 #include <qwidget.h>
00037 #include <qlayout.h>
00038 #include <qvariant.h>
00039 #include <qtooltip.h>
00040 #ifndef Q_WS_QWS
00041 #include <qwhatsthis.h>
00042 #endif
00043 
00044 /* STD */
00045 // #include <unistd.h>
00046 // #include <stdio.h>
00047 // #include <stdlib.h>
00048 
00049 /*
00050  *  The dialog will by default be modeless, unless you set 'modal' to
00051  *  TRUE to construct a modal dialog.
00052  */
00053 optionsDialog::optionsDialog( QWidget* parent,  const char* name, bool modal, WFlags fl )
00054         : QDialog( parent, name, modal, fl )
00055 {
00056     if ( !name )
00057         setName( "optionsDialog" );
00058     changedFonts=FALSE;
00059     //    styleChanged=FALSE;
00060 //    connect( this,SIGNAL( aboutToQuit()),SLOT( OnExit()) );
00061     b_qExit=TRUE;
00062     initDialog();
00063 
00064     ftpSiteDlg();
00065     BrowserDlg();
00066     FontDialog();
00067 }
00068 
00069 optionsDialog::~optionsDialog()
00070 {
00071 //odebug << "OnExit()" << oendl;
00072 //    writeConfig();
00073 }
00074 
00076 void optionsDialog::doOptions() {
00077 
00078 //    config.read();
00079     getConfig();
00080 }
00081 
00082 void optionsDialog::getConfig()
00083 {
00084     Config config("Gutenbrowser");
00085     config.setGroup( "FTPsite" );  // ftp server config
00086     ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
00087     ftp_base_dir= config.readEntry("base",  "/pub/gutenberg");
00088 
00089     TextLabel3->setText( "Current ftp server:\n"+ftp_host/* + ftp_base_dir */);
00090 
00091     config.setGroup( "Proxy" ); // use ftp/http config
00092     if( config.readEntry("IsChecked", "FALSE") == "TRUE") {
00093         Ftp_CheckBox->setChecked( FALSE);
00094     } else {
00095         Ftp_CheckBox->setChecked( TRUE);
00096     }
00097 
00098     config.setGroup( "HttpServer" );
00099     QString s_http = config.readEntry("Preferred", "http://sailor.gutenbook.org");
00100     if( s_http == "http://sailor.gutenbook.org")
00101         ComboBox1->setCurrentItem(0);
00102     else
00103         ComboBox1->setCurrentItem(1);
00104 
00105     config.setGroup( "Browser" );
00106     brow = config.readEntry("Preferred", "Opera");
00107     browserName=brow;
00108 
00109     TextLabel3_3->setText( "Current http browser:\n"+brow );
00110 
00111     config.setGroup( "Geometry" );
00112 
00113     //    bool ok2;
00114     QString temp;
00115 //      config.setGroup( "StyleIze" );
00116 //      temp = config.readEntry( "Style", "0");
00117 //      int i_style=temp.toInt( &ok2,10);
00118 //  #ifndef Q_WS_QWS
00119 
00120 //          if( i_style==0){ styleInt=0; ComboBoxStyle->setCurrentItem(0);}//"styleMetal"));
00121 //          if( i_style==1) { styleInt=1; ComboBoxStyle->setCurrentItem(1);}//"styleWindows") );
00122 //          if( i_style==2) { styleInt=2; ComboBoxStyle->setCurrentItem(2);}//"stylePlatinum"));
00123 //        if( i_style==2){ styleInt=2; ComboBoxStyle->setCurrentItem(2);}//"styleCDE") );
00124 //        if( i_style==3) { styleInt=3; ComboBoxStyle->setCurrentItem(3);}//"styleMotif") );
00125 //        if( i_style==4) { styleInt=4; ComboBoxStyle->setCurrentItem(4);}//"styleMotifPlus"));
00126 //  //      if( i_style==5) { styleInt=5; ComboBoxStyle->setCurrentItem(5);}//"styleWood") );
00127 //        if( i_style==6) { styleInt=6; ComboBoxStyle->setCurrentItem(6);}//"styleSgi") );
00128 //        if( i_style==7) { styleInt=7; ComboBoxStyle->setCurrentItem(7);}//"stylePlatinumPlus") );
00129 //      if( i_style==9){ styleInt=9; ComboBoxStyle->setCurrentItem(9);}//"styleLace"));
00130 //      if( i_style==10){ styleInt=10; ComboBoxStyle->setCurrentItem(10);}//"styleLacePlus"));
00131 //  #endif
00132     config.setGroup("General");
00133     QString qExit=config.readEntry("queryExit","TRUE");
00134     if(qExit=="TRUE") {
00135         cb_queryExit->setChecked(TRUE);
00136         odebug << "Config Setting    b_qExit=TRUE;" << oendl;
00137         b_qExit=TRUE;
00138     } else {
00139         cb_queryExit->setChecked(FALSE);
00140         odebug << "ConfigSetting    b_qExit=FALSE;" << oendl;
00141         b_qExit=FALSE;
00142     }
00143 
00144 
00145       useWordWrap_CheckBox->setChecked( config.readBoolEntry("WordWrap", 1));
00146       QString downDir=config.readEntry( "DownloadDirectory",local_library);
00147       downloadDirEdit->setText(downDir);
00148 } // end getConfig
00149 
00150 //  //  void optionsDialog::setStyle( int index) {
00151 
00152 //  //      odebug << "Set style" << index << "" << oendl;
00153 //  //  //int styleInt= index;
00154 //  //   styleChanged=TRUE;
00155 //  //        if( ComboBoxStyle->currentItem()==0) styleInt=0;//"styleMetal"));
00156 //  //        if( ComboBoxStyle->currentItem()==1) styleInt=1;//"styleWindows") );
00157 //  //        if( ComboBoxStyle->currentItem()==2) styleInt=2;//"stylePlatinum"));
00158 //  //  //      if( ComboBoxStyle->currentItem()==2) styleInt=2;//"styleCDE") );
00159 //  //  //      if( ComboBoxStyle->currentItem()==3) styleInt=3;//"styleMotif") );
00160 //  //  //      if( ComboBoxStyle->currentItem()==4) styleInt=4;//"styleMotifPlus"));
00161 //  //  //  //    if( ComboBoxStyle->currentItem()==5) styleInt=5;//"styleWood") );
00162 //  //  //      if( ComboBoxStyle->currentItem()==6) styleInt=6;//"styleSgi") );
00163 //  //  //      if( ComboBoxStyle->currentItem()==7) styleInt=7;//"stylePlatinumPlus") );
00164 //  //  //    if( ComboBoxStyle->currentItem()==9) styleInt=9;//"styleLace"));
00165 //  //  //    if( ComboBoxStyle->currentItem()==10) styleInt=10;//"styleLacePlus"));
00166 //  //      QString temp;
00167 //  //      temp.setNum(styleInt, 10);
00168 //  //      Config config("Gutenbrowser");
00169 //  //      config.setGroup( "StyleIze" );
00170 //  //      config.writeEntry( "Style", temp);
00171 //  //      config.write();
00172 //  //  }
00173 
00174 void optionsDialog::slotQueryExit()
00175 {
00176     Config config("Gutenbrowser");
00177     config.setGroup("General");
00178     odebug << "writing queryExit" << oendl;
00179     if(cb_queryExit->isChecked()) {
00180         b_qExit=TRUE;
00181         config.writeEntry("queryExit","TRUE");
00182         odebug << "WritingConfig queryExit=TRUE" << oendl;
00183     } else {
00184         b_qExit=FALSE;
00185         config.writeEntry("queryExit","FALSE");
00186         odebug << "WritingConfig queryExit=FALSE" << oendl;
00187     }
00188     config.write();
00189 }
00190 
00191 
00192 //  void optionsDialog::slotUseSplit()
00193 //  {
00194 
00195 //  }
00196 
00197 //  void optionsDialog::lineEditChanged(const QString &editText) {
00198 //      odebug << editText << oendl;
00199 //  }
00200 
00201 void optionsDialog::changeFonts()
00202 {
00203     changedFonts=TRUE;
00204 }
00205 
00206 
00207 void optionsDialog::slotWordWrap(bool b) {
00208 
00209   Config config("Gutenbrowser");
00210   config.setGroup("General");
00211 
00212   config.writeEntry("WordWrap", b);
00213   config.write();
00214 
00215 }

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