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

packagewin.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 "packagewin.h"
00031 #include "package.h"
00032 #include "datamgr.h"
00033 
00034 #include <opie2/oresource.h>
00035 
00036 #include <qlayout.h>
00037 #include <qpushbutton.h>
00038 #include <qstring.h>
00039 #include <qtextview.h>
00040 
00041 PackageWindow::PackageWindow( Package *package, const QString &server )
00042         : QWidget( 0, 0, 0 )
00043 {
00044         QString str;
00045         if ( package )
00046         {
00047         Package *local = package->getLocalPackage();
00048                 setCaption( package->getPackageName() );
00049                 QString destName;
00050                 if ( local )
00051                 {
00052                         if ( local->getInstalledTo() )
00053                                 destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
00054                 }
00055                 else
00056                 {
00057                         if ( package->getInstalledTo() )
00058                                 destName = package->getInstalledTo()->getDestinationName();
00059                 }
00060 
00061                 if ( !package->isPackageStoredLocally() )
00062                 {
00063                         str.append( tr( "<b>Description</b> - " ) );
00064                         str.append( package->getDescription() );
00065                         if ( !destName.isNull() )
00066                         {
00067                                 str.append( tr( "<p><b>Installed To</b> - " ) );
00068                                 str.append( destName );
00069                         }
00070                         str.append( tr( "<p><b>Size</b> - " ) );
00071                         str.append( package->getPackageSize() );
00072                         str.append( tr( "<p><b>Section</b> - " ) );
00073                         str.append( package->getSection() );
00074                 }
00075                 else
00076                 {
00077                         str.append( tr( "<p><b>Filename</b> - " ) );
00078                         str.append( package->getFilename() );
00079                 }
00080 
00081                 if ( server == LOCAL_SERVER )
00082                 {
00083                         str.append( tr( "<p><b>Version Installed</b> - " ) );
00084                         str.append( package->getVersion() );
00085                 }
00086                 else
00087                 {
00088                         str.append( tr( "<p><b>Version Available</b> - " ) );
00089                         str.append( package->getVersion() );
00090                         if ( local )
00091                         {
00092                                 if ( package->isInstalled() )
00093                                 {
00094                                         str.append( tr( "<p><b>Version Installed</b> - " ) );
00095                                         str.append( package->getInstalledVersion() );
00096                                 }
00097                         }
00098                 }
00099         }
00100         else
00101         {
00102                 setCaption( tr( "Package Information" ) );
00103                 str = tr( "Package information is unavailable" );
00104         }
00105 
00106         QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 );
00107 
00108         QTextView *l = new QTextView( str, QString::null, this );
00109         layout->addWidget( l );
00110 
00111         QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ), tr( "Close" ), this );
00112         layout->addWidget( btn );
00113         connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) );
00114 
00115 }
00116 
00117 PackageWindow::~PackageWindow()
00118 {
00119 }

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