summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp44
-rw-r--r--noncore/settings/aqpkg/mainwin.h3
2 files changed, 26 insertions, 21 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index c9963bc..8090646 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -287,25 +287,25 @@ void MainWindow :: init()
connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
mgr->loadServers();
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
categoryFilterEnabled = false;
updateData();
stack->raiseWidget( networkPkgWindow );
}
-
+/*
void MainWindow :: setDocument( const QString &doc )
{
// Remove path from package
QString package = Utils::getPackageNameFromIpkFilename( doc );
// std::cout << "Selecting package " << package << std::endl;
// First select local server
for ( int i = 0 ; i < serversList->count() ; ++i )
{
if ( serversList->text( i ) == LOCAL_IPKGS )
{
serversList->setCurrentItem( i );
@@ -317,30 +317,34 @@ void MainWindow :: setDocument( const QString &doc )
// Now set the check box of the selected package
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().startsWith( package ) )
{
item->setOn( true );
break;
}
}
}
-
+*/
void MainWindow :: displaySettings()
{
SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
if ( dlg->showDlg( 0 ) )
+ {
+ stack->raiseWidget( progressWindow );
updateData();
+ stack->raiseWidget( networkPkgWindow );
+ }
delete dlg;
}
void MainWindow :: displayHelp()
{
HelpWindow *dlg = new HelpWindow( this );
dlg->exec();
delete dlg;
}
void MainWindow :: displayFindBar()
{
@@ -719,26 +723,26 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
stack->raiseWidget( networkPkgWindow );
}
}
void MainWindow :: searchForPackage( const QString &text )
{
if ( !text.isEmpty() )
{
// cout << "searching for " << text << endl;
// look through package list for text startng at current position
vector<InstallData> workingPackages;
QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
- if ( start != 0 )
- start = (QCheckListItem *)start->nextSibling();
+// if ( start != 0 )
+// start = (QCheckListItem *)start->nextSibling();
if ( start == 0 )
start = (QCheckListItem *)packagesList->firstChild();
for ( QCheckListItem *item = start; item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
// cout << "checking " << item->text().lower() << endl;
if ( item->text().lower().find( text ) != -1 )
{
// cout << "matched " << item->text() << endl;
packagesList->ensureItemVisible( item );
@@ -758,27 +762,26 @@ void MainWindow :: updateServer()
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
Ipkg ipkg;
ipkg.setOption( "update" );
InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true );
dlg.showDlg();
- // Reload data
- mgr->reloadServerData();
- serverSelected(-1);
+ reloadData();
+
// delete progDlg;
}
void MainWindow :: upgradePackages()
{
// We're gonna do an upgrade of all packages
// First warn user that this isn't recommended
// TODO - ODevice????
QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
QMessageBox::Yes,
QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
@@ -788,27 +791,25 @@ void MainWindow :: upgradePackages()
if ( warn.exec() == QMessageBox::Yes )
{
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
// Now run upgrade
Ipkg ipkg;
ipkg.setOption( "upgrade" );
InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true );
dlg.showDlg();
- // Reload data
- mgr->reloadServerData();
- serverSelected(-1);
+ reloadData();
}
}
void MainWindow :: downloadPackage()
{
bool doUpdate = true;
if ( downloadEnabled )
{
// See if any packages are selected
bool found = false;
if ( serversList->currentText() != LOCAL_SERVER )
{
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
@@ -855,26 +856,25 @@ void MainWindow :: upgradePackages()
msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
{
doUpdate = true;
QFile f( p->getFilename() );
f.remove();
}
}
}
}
if ( doUpdate )
{
- mgr->reloadServerData();
- serverSelected( -1 );
+ reloadData();
}
}
void MainWindow :: downloadSelectedPackages()
{
// First, write out ipkg_conf file so that ipkg can use it
mgr->writeOutIpkgConf();
// Display dialog to user asking where to download the files to
bool ok = FALSE;
QString dir = "";
#ifdef QWS
@@ -931,28 +931,26 @@ void MainWindow :: downloadRemotePackage()
// grab details from dialog
// QString package = dlg.getPackageLocation();
InstallData item;
item.option = "I";
item.packageName = package;
vector<InstallData> workingPackages;
workingPackages.push_back( item );
InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true );
dlg2.showDlg();
- // Reload data
- mgr->reloadServerData();
- serverSelected(-1);
-
+ reloadData();
+
#ifdef QWS
// Finally let the main system update itself
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
#endif
}
void MainWindow :: applyChanges()
{
stickyOption = "";
@@ -979,28 +977,26 @@ void MainWindow :: applyChanges()
{
// Nothing to do
QMessageBox::information( this, tr( "Nothing to do" ),
tr( "No packages selected" ), tr( "OK" ) );
return;
}
// do the stuff
InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true );
dlg.showDlg();
- // Reload data
- mgr->reloadServerData();
- serverSelected(-1);
-
+ reloadData();
+
#ifdef QWS
// Finally let the main system update itself
QCopEnvelope e("QPE/System", "linkChanged(QString)");
QString lf = QString::null;
e << lf;
#endif
}
// decide what to do - either remove, upgrade or install
// Current rules:
// If not installed - install
// If installed and different version available - upgrade
@@ -1112,24 +1108,32 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
// Check if we are reinstalling the same version
if ( item.option != "R" )
item.recreateLinks = true;
else
item.recreateLinks = false;
// User hit cancel (on dlg - assume remove)
return item;
}
}
+void MainWindow :: reloadData()
+{
+ stack->raiseWidget( progressWindow );
+ mgr->reloadServerData();
+ serverSelected( -1, FALSE );
+ stack->raiseWidget( networkPkgWindow );
+}
+
void MainWindow :: letterPushed( QString t )
{
QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
if ( packagesList->firstChild() == 0 )
return;
QCheckListItem *item;
if ( start == 0 )
{
item = (QCheckListItem *)packagesList->firstChild();
start = top;
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 46b5fae..be30668 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -82,34 +82,35 @@ private:
bool showInstalledPkgs;
bool showUpgradedPkgs;
bool downloadEnabled;
void initMainWidget();
void updateData();
void serverSelected( int index, bool showProgress );
void searchForPackage( const QString & );
bool filterByCategory( bool val );
void downloadSelectedPackages();
void downloadRemotePackage();
InstallData dealWithItem( QCheckListItem *item );
+ void reloadData();
// Progress widget
QWidget *progressWindow;
QLabel *m_status;
QProgressBar *m_progress;
void initProgressWidget();
public slots:
- void setDocument( const QString &doc );
+// void setDocument( const QString &doc );
void displayHelp();
void displayFindBar();
void repeatFind();
void findPackage( const QString & );
void hideFindBar();
void displayAbout();
void displaySettings();
void filterUninstalledPackages();
void filterInstalledPackages();
void filterUpgradedPackages();
void filterCategory();
bool setFilterCategory();