summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/mainwin.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp143
1 files changed, 76 insertions, 67 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 361946c..8ae5815 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -545,3 +545,3 @@ void MainWindow :: updateData()
545{ 545{
546 m_progress->setTotalSteps( mgr->getServerList().size() ); 546 m_progress->setTotalSteps( mgr->getServerList().count() );
547 547
@@ -550,9 +550,13 @@ void MainWindow :: updateData()
550 550
551 vector<Server>::iterator it;
552 int activeItem = -1; 551 int activeItem = -1;
553 int i; 552 int i = 0;
554 QString serverName; 553 QString serverName;
555 for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i ) 554
555 QListIterator<Server> it( mgr->getServerList() );
556 Server *server;
557
558 for ( ; it.current(); ++it, ++i )
556 { 559 {
557 serverName = it->getServerName(); 560 server = it.current();
561 serverName = server->getServerName();
558 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); 562 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) );
@@ -562,3 +566,3 @@ void MainWindow :: updateData()
562// cout << "Adding " << it->getServerName() << " to combobox" << endl; 566// cout << "Adding " << it->getServerName() << " to combobox" << endl;
563 if ( !it->isServerActive() ) 567 if ( !server->isServerActive() )
564 { 568 {
@@ -594,9 +598,9 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
594 598
595 vector<Server>::iterator s = mgr->getServer( serverName ); 599 Server *s = mgr->getServer( serverName );
596 600
597 vector<Package> &list = s->getPackageList(); 601 QList<Package> &list = s->getPackageList();
598 vector<Package>::iterator it; 602 QListIterator<Package> it( list );
599 603
600 // Display progress widget while loading list 604 // Display progress widget while loading list
601 bool doProgress = ( list.size() > 200 ); 605 bool doProgress = ( list.count() > 200 );
602 if ( doProgress ) 606 if ( doProgress )
@@ -607,3 +611,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
607 } 611 }
608 m_progress->setTotalSteps( list.size() ); 612 m_progress->setTotalSteps( list.count() );
609 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); 613 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
@@ -621,3 +625,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
621 int i = 0; 625 int i = 0;
622 for ( it = list.begin() ; it != list.end() ; ++it ) 626 Package *package;
627 for ( ; it.current(); ++it )
623 { 628 {
@@ -636,4 +641,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
636 641
642 package = it.current();
643
637 // Apply show only uninstalled packages filter 644 // Apply show only uninstalled packages filter
638 if ( showUninstalledPkgs && it->isInstalled() ) 645 if ( showUninstalledPkgs && package->isInstalled() )
639 continue; 646 continue;
@@ -641,3 +648,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
641 // Apply show only installed packages filter 648 // Apply show only installed packages filter
642 if ( showInstalledPkgs && !it->isInstalled() ) 649 if ( showInstalledPkgs && !package->isInstalled() )
643 continue; 650 continue;
@@ -647,4 +654,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
647 { 654 {
648 if ( !it->isInstalled() || 655 if ( !package->isInstalled() ||
649 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 656 compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 )
650 continue; 657 continue;
@@ -655,3 +662,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
655 { 662 {
656 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) 663 if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 )
657 continue; 664 continue;
@@ -660,3 +667,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
660 // If the local server, only display installed packages 667 // If the local server, only display installed packages
661 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 668 if ( serverName == LOCAL_SERVER && !package->isInstalled() )
662 continue; 669 continue;
@@ -664,5 +671,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
664 671
665 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); 672 QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
673 QCheckListItem::CheckBox );
666 674
667 if ( it->isInstalled() ) 675 if ( package->isInstalled() )
668 { 676 {
@@ -670,4 +678,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
670 // Otherwise, show installed icon 678 // Otherwise, show installed icon
671 if ( it->getVersion() != it->getInstalledVersion() && 679 if ( package->getVersion() != package->getInstalledVersion() &&
672 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) 680 compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1)
673 { 681 {
@@ -682,6 +690,6 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
682 QString destName = ""; 690 QString destName = "";
683 if ( it->getLocalPackage() ) 691 if ( package->getLocalPackage() )
684 { 692 {
685 if ( it->getLocalPackage()->getInstalledTo() ) 693 if ( package->getLocalPackage()->getInstalledTo() )
686 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 694 destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
687 } 695 }
@@ -689,4 +697,4 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
689 { 697 {
690 if ( it->getInstalledTo() ) 698 if ( package->getInstalledTo() )
691 destName = it->getInstalledTo()->getDestinationName(); 699 destName = package->getInstalledTo()->getDestinationName();
692 } 700 }
@@ -700,10 +708,10 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
700 708
701 if ( !it->isPackageStoredLocally() ) 709 if ( !package->isPackageStoredLocally() )
702 { 710 {
703 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); 711 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) );
704 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); 712 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) );
705 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); 713 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) );
706 } 714 }
707 else 715 else
708 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); 716 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) );
709 717
@@ -711,3 +719,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
711 { 719 {
712 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); 720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) );
713 } 721 }
@@ -715,7 +723,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
715 { 723 {
716 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); 724 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) );
717 if ( it->getLocalPackage() ) 725 if ( package->getLocalPackage() )
718 { 726 {
719 if ( it->isInstalled() ) 727 if ( package->isInstalled() )
720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); 728 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) );
721 } 729 }
@@ -757,3 +765,3 @@ void MainWindow :: searchForPackage( const QString &text )
757 // look through package list for text startng at current position 765 // look through package list for text startng at current position
758 vector<InstallData> workingPackages; 766// vector<InstallData> workingPackages;
759 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 767 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
@@ -959,7 +967,8 @@ void MainWindow :: downloadRemotePackage()
959 967
960 InstallData item; 968 InstallData *item = new InstallData();
961 item.option = "I"; 969 item->option = "I";
962 item.packageName = package; 970 item->packageName = package;
963 vector<InstallData> workingPackages; 971 QList<InstallData> workingPackages;
964 workingPackages.push_back( item ); 972 workingPackages.setAutoDelete( TRUE );
973 workingPackages.append( item );
965 974
@@ -981,3 +990,4 @@ void MainWindow :: applyChanges()
981 990
982 vector<InstallData> workingPackages; 991 QList<InstallData> workingPackages;
992 workingPackages.setAutoDelete( TRUE );
983 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 993 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
@@ -988,4 +998,3 @@ void MainWindow :: applyChanges()
988 { 998 {
989 InstallData data = dealWithItem( item ); 999 workingPackages.append( dealWithItem( item ) );
990 workingPackages.push_back( data );
991 } 1000 }
@@ -993,3 +1002,3 @@ void MainWindow :: applyChanges()
993 1002
994 if ( workingPackages.size() == 0 ) 1003 if ( workingPackages.count() == 0 )
995 { 1004 {
@@ -1013,3 +1022,3 @@ void MainWindow :: applyChanges()
1013// If installed and version up to date - remove 1022// If installed and version up to date - remove
1014InstallData MainWindow :: dealWithItem( QCheckListItem *item ) 1023InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1015{ 1024{
@@ -1018,3 +1027,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1018 // Get package 1027 // Get package
1019 vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); 1028 Server *s = mgr->getServer( serversList->currentText() );
1020 Package *p = s->getPackage( name ); 1029 Package *p = s->getPackage( name );
@@ -1029,6 +1038,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1029 { 1038 {
1030 InstallData item; 1039 InstallData *newitem = new InstallData();;
1031 item.option = "I"; 1040 newitem->option = "I";
1032 item.packageName = name; 1041 newitem->packageName = name;
1033 return item; 1042 return newitem;
1034 } 1043 }
@@ -1036,8 +1045,8 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1036 { 1045 {
1037 InstallData item; 1046 InstallData *newitem = new InstallData();;
1038 item.option = "D"; 1047 newitem->option = "D";
1039 if ( !p->isPackageStoredLocally() ) 1048 if ( !p->isPackageStoredLocally() )
1040 item.packageName = p->getInstalledPackageName(); 1049 newitem->packageName = p->getInstalledPackageName();
1041 else 1050 else
1042 item.packageName = name; 1051 newitem->packageName = name;
1043 1052
@@ -1045,3 +1054,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1045 { 1054 {
1046 item.destination = p->getInstalledTo(); 1055 newitem->destination = p->getInstalledTo();
1047// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 1056// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
@@ -1051,3 +1060,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1051 { 1060 {
1052 item.destination = p->getLocalPackage()->getInstalledTo(); 1061 newitem->destination = p->getLocalPackage()->getInstalledTo();
1053 } 1062 }
@@ -1068,3 +1077,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1068 // Version available is older - remove only 1077 // Version available is older - remove only
1069 item.option = "D"; 1078 newitem->option = "D";
1070 } 1079 }
@@ -1104,6 +1113,6 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1104 // option 0 = Remove 1113 // option 0 = Remove
1105 item.option = "D"; 1114 newitem->option = "D";
1106 break; 1115 break;
1107 case 1: // Quit or Escape 1116 case 1: // Quit or Escape
1108 item.option = secondOption; 1117 newitem->option = secondOption;
1109 break; 1118 break;
@@ -1113,3 +1122,3 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1113 { 1122 {
1114// item.option = stickyOption; 1123// newitem->option = stickyOption;
1115 } 1124 }
@@ -1119,9 +1128,9 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1119 // Check if we are reinstalling the same version 1128 // Check if we are reinstalling the same version
1120 if ( item.option != "R" ) 1129 if ( newitem->option != "R" )
1121 item.recreateLinks = true; 1130 newitem->recreateLinks = true;
1122 else 1131 else
1123 item.recreateLinks = false; 1132 newitem->recreateLinks = false;
1124 1133
1125 // User hit cancel (on dlg - assume remove) 1134 // User hit cancel (on dlg - assume remove)
1126 return item; 1135 return newitem;
1127 } 1136 }