summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-21 16:02:45 (UTC)
committer andyq <andyq>2002-10-21 16:02:45 (UTC)
commit71c7800e8ae5dc2d701242828ceb8c11bcd96fbe (patch) (side-by-side diff)
tree5068eae7a8a4059a4092dce2101bf906761e53bf
parentbb135a644e61cbc30116b96ff8fb24dfb7576a21 (diff)
downloadopie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.zip
opie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.tar.gz
opie-71c7800e8ae5dc2d701242828ceb8c11bcd96fbe.tar.bz2
Changed so that there are 13 letter buttons on each line - previously N, O & P
were missing (presumed dead)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 9acaaf1..52d95a8 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -10,257 +10,257 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <fstream>
#include <iostream>
using namespace std;
#include <unistd.h>
#include <stdlib.h>
#include <linux/limits.h>
#ifdef QWS
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#else
#include <qapplication.h>
#endif
#include <qlabel.h>
#include <qfile.h>
#include <qmessagebox.h>
#include "datamgr.h"
#include "networkpkgmgr.h"
#include "installdlgimpl.h"
#include "ipkg.h"
#include "inputdlg.h"
#include "letterpushbutton.h"
#include "global.h"
NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
: QWidget(parent, name)
{
dataMgr = dataManager;
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
initGui();
setupConnections();
progressDlg = 0;
timerId = startTimer( 100 );
}
NetworkPackageManager::~NetworkPackageManager()
{
}
void NetworkPackageManager :: timerEvent ( QTimerEvent * )
{
killTimer( timerId );
// showProgressDialog();
// Add server names to listbox
updateData();
// progressDlg->hide();
}
void NetworkPackageManager :: updateData()
{
serversList->clear();
packagesList->clear();
vector<Server>::iterator it;
int activeItem = -1;
int i;
for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
{
if ( !it->isServerActive() )
{
i--;
continue;
}
serversList->insertItem( it->getServerName() );
if ( it->getServerName() == currentlySelectedServer )
activeItem = i;
}
// set selected server to be active server
if ( activeItem != -1 )
serversList->setCurrentItem( activeItem );
serverSelected( 0 );
}
void NetworkPackageManager :: initGui()
{
QLabel *l = new QLabel( "Servers", this );
serversList = new QComboBox( this );
packagesList = new QListView( this );
update = new QPushButton( "Refresh List", this );
download = new QPushButton( "Download", this );
upgrade = new QPushButton( "Upgrade", this );
apply = new QPushButton( "Apply", this );
QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
hbox1->addWidget( l );
hbox1->addWidget( serversList );
QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
if ( showJumpTo )
{
char text[2];
text[1] = '\0';
for ( int i = 0 ; i < 26 ; ++i )
{
text[0] = 'A' + i;
LetterPushButton *b = new LetterPushButton( text, this );
connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
- if ( i < 16 )
+ if ( i < 13 )
hbox3->addWidget( b );
else
hbox4->addWidget( b );
}
}
vbox->addWidget( packagesList );
packagesList->addColumn( "Packages" );
QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
hbox2->addWidget( update );
hbox2->addWidget( download );
hbox2->addWidget( upgrade );
hbox2->addWidget( apply );
}
void NetworkPackageManager :: setupConnections()
{
connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
}
void NetworkPackageManager :: showProgressDialog( char *initialText )
{
if ( !progressDlg )
progressDlg = new ProgressDlg( this, "Progress", false );
progressDlg->setText( initialText );
progressDlg->show();
}
void NetworkPackageManager :: serverSelected( int )
{
packagesList->clear();
// display packages
QString serverName = serversList->currentText();
currentlySelectedServer = serverName;
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "selectedServer", currentlySelectedServer );
#endif
Server *s = dataMgr->getServer( serverName );
// dataMgr->setActiveServer( serverName );
vector<Package> &list = s->getPackageList();
vector<Package>::iterator it;
for ( it = list.begin() ; it != list.end() ; ++it )
{
QString text = "";
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !it->isInstalled() )
continue;
text += it->getPackageName();
if ( it->isInstalled() )
{
text += " (installed)";
// If a different version of package is available, postfix it with an *
if ( it->getVersion() != it->getInstalledVersion() )
text += "*";
}
QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
if ( it->isInstalled() )
{
QString destName = "";
if ( it->getLocalPackage() )
{
if ( it->getLocalPackage()->getInstalledTo() )
destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
}
else
{
if ( it->getInstalledTo() )
destName = it->getInstalledTo()->getDestinationName();
}
if ( destName != "" )
new QCheckListItem( item, QString( "Installed To - " ) + destName );
}
if ( !it->isPackageStoredLocally() )
new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
else
new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
if ( it->getLocalPackage() )
{
if ( it->isInstalled() )
new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
}
packagesList->insertItem( item );
}
// If the local server or the local ipkgs server disable the download button
if ( serverName == LOCAL_SERVER )
{
upgrade->setEnabled( false );
download->setText( "Download" );
download->setEnabled( false );
}
else if ( serverName == LOCAL_IPKGS )
{
upgrade->setEnabled( false );
download->setEnabled( true );
download->setText( "Remove" );
}
else
{
upgrade->setEnabled( true );
download->setEnabled( true );
download->setText( "Download" );
}
}
void NetworkPackageManager :: updateServer()
{