summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/networkpkgmgr.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/networkpkgmgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 78d3df5..a058285 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -582,126 +582,130 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
QString text;
QString secondButton;
QString secondOption;
if ( val == 0 )
{
// Version available is the same - option to remove or reinstall
caption = "Do you wish to remove or reinstall\n%s?";
text = "Remove or ReInstall";
secondButton = "ReInstall";
secondOption = "R";
}
else if ( val == 1 )
{
// Version available is newer - option to remove or upgrade
caption = "Do you wish to remove or upgrade\n%s?";
text = "Remove or Upgrade";
secondButton = "Upgrade";
secondOption = "U";
}
// Sticky option not implemented yet, but will eventually allow
// the user to say something like 'remove all'
if ( stickyOption == "" )
{
QString msgtext;
msgtext.sprintf( caption, (const char *)name );
switch( QMessageBox::information( this, text,
msgtext, "Remove", secondButton ) )
{
case 0: // Try again or Enter
// option 0 = Remove
item.option = "D";
break;
case 1: // Quit or Escape
item.option = secondOption;
break;
}
}
else
{
// item.option = stickyOption;
}
}
// 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 NetworkPackageManager :: displayText( const QString &t )
{
cout << t << endl;
}
void NetworkPackageManager :: 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;
}
else
item = (QCheckListItem *)start->nextSibling();
if ( item == 0 )
item = (QCheckListItem *)packagesList->firstChild();
do
{
if ( item->text().lower().startsWith( t.lower() ) )
{
packagesList->setSelected( item, true );
packagesList->ensureItemVisible( item );
break;
}
item = (QCheckListItem *)item->nextSibling();
if ( !item )
item = (QCheckListItem *)packagesList->firstChild();
} while ( item != start);
}
-void NetworkPackageManager :: searchForPackage()
+void NetworkPackageManager :: searchForPackage( bool findNext )
{
- bool ok = FALSE;
- QString searchText = InputDialog::getText( "Search for package", "Enter package to search for", QString::null, &ok, this ).lower();
- if ( ok && !searchText.isEmpty() )
+ bool ok = false;
+ if ( !findNext || lastSearchText.isEmpty() )
+ lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower();
+ else
+ ok = true;
+
+ if ( ok && !lastSearchText.isEmpty() )
{
- cout << "searching for " << searchText << endl;
+ cout << "searching for " << lastSearchText << 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 *)packagesList->firstChild();
for ( QCheckListItem *item = start; item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
cout << "checking " << item->text().lower() << endl;
- if ( item->text().lower().find( searchText ) != -1 )
+ if ( item->text().lower().find( lastSearchText ) != -1 )
{
cout << "matched " << item->text() << endl;
packagesList->ensureItemVisible( item );
packagesList->setCurrentItem( item );
break;
}
}
}
} \ No newline at end of file