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

instoptionsimpl.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the OPIE Project
00003                              
00004                =.            Copyright (c)  2002 Andy Qua <andy.qua@blueyonder.co.uk>
00005              .=l.                                Dan Williams <drw@handhelds.org>
00006            .>+-=
00007  _;:,     .>    :=|.         This file is free software; you can
00008 .> <`_,   >  .   <=          redistribute it and/or modify it under
00009 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00010 .="- .-=="i,     .._         License as published by the Free Software
00011  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00012      ._= =}       :          or (at your option) any later version.
00013     .%`+i>       _;_.
00014     .i_,=:_.      -<s.       This file is distributed in the hope that
00015      +  .  -:.       =       it will be useful, but WITHOUT ANY WARRANTY;
00016     : ..    .:,     . . .    without even the implied warranty of
00017     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00018   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU General
00019 ..}^=.=       =       ;      Public License for more details.
00020 ++=   -.     .`     .:
00021  :     =  ...= . :.=-        You should have received a copy of the GNU
00022  -.   .:....=;==+<;          General Public License along with this file;
00023   -_. . .   )=.  =           see the file COPYING. If not, write to the
00024     --        :-=`           Free Software Foundation, Inc.,
00025                              59 Temple Place - Suite 330,
00026                              Boston, MA 02111-1307, USA.
00027 
00028 */
00029 
00030 #include "global.h"
00031 #include "instoptionsimpl.h"
00032 #include "ipkg.h"
00033 
00034 /* OPIE */
00035 #ifdef QWS
00036 #include <qpe/config.h>
00037 #endif
00038 #include <qpe/qpeapplication.h>
00039 
00040 /* QT */
00041 #include <qcheckbox.h>
00042 #include <qcombobox.h>
00043 #include <qgroupbox.h>
00044 #include <qlabel.h>
00045 #include <qlayout.h>
00046 
00047 InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl )
00048         : QDialog( parent, name, modal, fl )
00049 {
00050     setCaption( tr( "Options" ) );
00051 
00052     QVBoxLayout *layout = new QVBoxLayout( this );
00053     layout->setMargin( 2 );
00054     layout->setSpacing( 4 );
00055 
00056     QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this );
00057     grpbox->layout()->setSpacing( 2 );
00058     grpbox->layout()->setMargin( 4 );
00059     layout->addWidget( grpbox );
00060 
00061     QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
00062 
00063     forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox );
00064     grplayout->addWidget( forceDepends );
00065 
00066     forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox );
00067     grplayout->addWidget( forceReinstall );
00068 
00069     forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox );
00070     grplayout->addWidget( forceRemove );
00071 
00072     forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox );
00073     grplayout->addWidget( forceOverwrite );
00074 
00075     QLabel *l = new QLabel( tr( "Information Level" ), grpbox );
00076     grplayout->addWidget( l );
00077 
00078     verboseIpkg = new QComboBox( grpbox );
00079     verboseIpkg->insertItem( tr( "Errors only" ) );
00080     verboseIpkg->insertItem( tr( "Normal messages" ) );
00081     verboseIpkg->insertItem( tr( "Informative messages" ) );
00082     verboseIpkg->insertItem( tr( "Troubleshooting output" ) );
00083     verboseIpkg->setCurrentItem( verb );
00084     grplayout->addWidget( verboseIpkg );
00085 
00086     grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
00087 
00088     if ( flags & FORCE_DEPENDS )
00089         forceDepends->setChecked( true );
00090     if ( flags & FORCE_REINSTALL )
00091         forceReinstall->setChecked( true );
00092     if ( flags & FORCE_REMOVE )
00093         forceRemove->setChecked( true );
00094     if ( flags & FORCE_OVERWRITE )
00095         forceOverwrite->setChecked( true );
00096     //    if ( flags & VERBOSE_WGET )
00097     //          verboseWget->setChecked( true );
00098     //    if ( flags & MAKE_LINKS )
00099     //          makeLinks->setChecked( true );
00100 
00101     QPEApplication::showDialog( this );
00102 
00103 }
00104 
00105 InstallOptionsDlgImpl::~InstallOptionsDlgImpl()
00106 {}
00107 
00108 
00109 int InstallOptionsDlgImpl :: getFlags()
00110 {
00111     int flags = 0;
00112 
00113     if ( forceDepends->isChecked() )
00114         flags |= FORCE_DEPENDS;
00115     if ( forceReinstall->isChecked() )
00116         flags |= FORCE_REINSTALL;
00117     if ( forceRemove->isChecked() )
00118         flags |= FORCE_REMOVE;
00119     if ( forceOverwrite->isChecked() )
00120         flags |= FORCE_OVERWRITE;
00121     if ( verboseWget->isChecked() )
00122         flags |= VERBOSE_WGET;
00123 
00124     return flags;
00125 }
00126 
00127 int InstallOptionsDlgImpl :: getInfoLevel()
00128 {
00129     return verboseIpkg->currentItem();
00130 }

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