Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index a25f5a7..947aace 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -42,12 +42,13 @@ | |||
42 | 42 | ||
43 | #include "categoryfilterimpl.h" | 43 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 44 | #include "datamgr.h" |
45 | #include "global.h" | 45 | #include "global.h" |
46 | #include "helpwindow.h" | 46 | #include "helpwindow.h" |
47 | #include "inputdlg.h" | 47 | #include "inputdlg.h" |
48 | #include "ipkg.h" | ||
48 | #include "installdlgimpl.h" | 49 | #include "installdlgimpl.h" |
49 | #include "letterpushbutton.h" | 50 | #include "letterpushbutton.h" |
50 | #include "mainwin.h" | 51 | #include "mainwin.h" |
51 | #include "settingsimpl.h" | 52 | #include "settingsimpl.h" |
52 | #include "utils.h" | 53 | #include "utils.h" |
53 | 54 | ||
@@ -85,30 +86,21 @@ MainWindow :: MainWindow() | |||
85 | addToolBar( jumpBar, QMainWindow::Top, true ); | 86 | addToolBar( jumpBar, QMainWindow::Top, true ); |
86 | jumpBar->setHorizontalStretchable( true ); | 87 | jumpBar->setHorizontalStretchable( true ); |
87 | QWidget *w = new QWidget( jumpBar ); | 88 | QWidget *w = new QWidget( jumpBar ); |
88 | jumpBar->setStretchableWidget( w ); | 89 | jumpBar->setStretchableWidget( w ); |
89 | 90 | ||
90 | QGridLayout *layout = new QGridLayout( w ); | 91 | QGridLayout *layout = new QGridLayout( w ); |
91 | //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 ); | ||
92 | //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
93 | //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
94 | 92 | ||
95 | char text[2]; | 93 | char text[2]; |
96 | text[1] = '\0'; | 94 | text[1] = '\0'; |
97 | for ( int i = 0 ; i < 26 ; ++i ) | 95 | for ( int i = 0 ; i < 26 ; ++i ) |
98 | { | 96 | { |
99 | text[0] = 'A' + i; | 97 | text[0] = 'A' + i; |
100 | LetterPushButton *b = new LetterPushButton( text, w ); | 98 | LetterPushButton *b = new LetterPushButton( text, w ); |
101 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 99 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
102 | layout->addWidget( b, i / 13, i % 13); | 100 | layout->addWidget( b, i / 13, i % 13); |
103 | /* | ||
104 | if ( i < 13 ) | ||
105 | hbox3->addWidget( b ); | ||
106 | else | ||
107 | hbox4->addWidget( b ); | ||
108 | */ | ||
109 | } | 101 | } |
110 | 102 | ||
111 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 103 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); |
112 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 104 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
113 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 105 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
114 | a->addTo( jumpBar ); | 106 | a->addTo( jumpBar ); |
@@ -795,19 +787,19 @@ void MainWindow :: updateServer() | |||
795 | 787 | ||
796 | // Disable buttons to stop silly people clicking lots on them :) | 788 | // Disable buttons to stop silly people clicking lots on them :) |
797 | 789 | ||
798 | // First, write out ipkg_conf file so that ipkg can use it | 790 | // First, write out ipkg_conf file so that ipkg can use it |
799 | mgr->writeOutIpkgConf(); | 791 | mgr->writeOutIpkgConf(); |
800 | 792 | ||
801 | Ipkg ipkg; | 793 | Ipkg *ipkg = new Ipkg; |
802 | ipkg.setOption( "update" ); | 794 | ipkg->setOption( "update" ); |
803 | |||
804 | InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); | ||
805 | dlg.showDlg(); | ||
806 | 795 | ||
807 | reloadData(); | 796 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
797 | tr( "Update lists" ) ); | ||
798 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | ||
799 | dlg->showMaximized(); | ||
808 | 800 | ||
809 | // delete progDlg; | 801 | // delete progDlg; |
810 | } | 802 | } |
811 | 803 | ||
812 | void MainWindow :: upgradePackages() | 804 | void MainWindow :: upgradePackages() |
813 | { | 805 | { |
@@ -824,21 +816,22 @@ void MainWindow :: upgradePackages() | |||
824 | if ( warn.exec() == QMessageBox::Yes ) | 816 | if ( warn.exec() == QMessageBox::Yes ) |
825 | { | 817 | { |
826 | // First, write out ipkg_conf file so that ipkg can use it | 818 | // First, write out ipkg_conf file so that ipkg can use it |
827 | mgr->writeOutIpkgConf(); | 819 | mgr->writeOutIpkgConf(); |
828 | 820 | ||
829 | // Now run upgrade | 821 | // Now run upgrade |
830 | Ipkg ipkg; | 822 | Ipkg *ipkg = new Ipkg; |
831 | ipkg.setOption( "upgrade" ); | 823 | ipkg->setOption( "upgrade" ); |
832 | |||
833 | InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); | ||
834 | dlg.showDlg(); | ||
835 | 824 | ||
836 | reloadData(); | 825 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
826 | tr ( "Upgrade" ) ); | ||
827 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | ||
828 | dlg->showMaximized(); | ||
837 | } | 829 | } |
838 | } | 830 | } |
831 | |||
839 | void MainWindow :: downloadPackage() | 832 | void MainWindow :: downloadPackage() |
840 | { | 833 | { |
841 | bool doUpdate = true; | 834 | bool doUpdate = true; |
842 | if ( downloadEnabled ) | 835 | if ( downloadEnabled ) |
843 | { | 836 | { |
844 | // See if any packages are selected | 837 | // See if any packages are selected |
@@ -895,13 +888,13 @@ void MainWindow :: upgradePackages() | |||
895 | } | 888 | } |
896 | } | 889 | } |
897 | } | 890 | } |
898 | 891 | ||
899 | if ( doUpdate ) | 892 | if ( doUpdate ) |
900 | { | 893 | { |
901 | reloadData(); | 894 | reloadData( 0x0 ); |
902 | } | 895 | } |
903 | } | 896 | } |
904 | 897 | ||
905 | void MainWindow :: downloadSelectedPackages() | 898 | void MainWindow :: downloadSelectedPackages() |
906 | { | 899 | { |
907 | // First, write out ipkg_conf file so that ipkg can use it | 900 | // First, write out ipkg_conf file so that ipkg can use it |
@@ -967,23 +960,15 @@ void MainWindow :: downloadRemotePackage() | |||
967 | InstallData item; | 960 | InstallData item; |
968 | item.option = "I"; | 961 | item.option = "I"; |
969 | item.packageName = package; | 962 | item.packageName = package; |
970 | vector<InstallData> workingPackages; | 963 | vector<InstallData> workingPackages; |
971 | workingPackages.push_back( item ); | 964 | workingPackages.push_back( item ); |
972 | 965 | ||
973 | InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true ); | 966 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
974 | dlg2.showDlg(); | 967 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
975 | 968 | dlg->showMaximized(); | |
976 | reloadData(); | ||
977 | |||
978 | #ifdef QWS | ||
979 | // Finally let the main system update itself | ||
980 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
981 | QString lf = QString::null; | ||
982 | e << lf; | ||
983 | #endif | ||
984 | } | 969 | } |
985 | 970 | ||
986 | 971 | ||
987 | void MainWindow :: applyChanges() | 972 | void MainWindow :: applyChanges() |
988 | { | 973 | { |
989 | stickyOption = ""; | 974 | stickyOption = ""; |
@@ -1013,23 +998,15 @@ void MainWindow :: applyChanges() | |||
1013 | tr( "No packages selected" ), tr( "OK" ) ); | 998 | tr( "No packages selected" ), tr( "OK" ) ); |
1014 | 999 | ||
1015 | return; | 1000 | return; |
1016 | } | 1001 | } |
1017 | 1002 | ||
1018 | // do the stuff | 1003 | // do the stuff |
1019 | InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true ); | 1004 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); |
1020 | dlg.showDlg(); | 1005 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
1021 | 1006 | dlg->showMaximized(); | |
1022 | reloadData(); | ||
1023 | |||
1024 | #ifdef QWS | ||
1025 | // Finally let the main system update itself | ||
1026 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
1027 | QString lf = QString::null; | ||
1028 | e << lf; | ||
1029 | #endif | ||
1030 | } | 1007 | } |
1031 | 1008 | ||
1032 | // decide what to do - either remove, upgrade or install | 1009 | // decide what to do - either remove, upgrade or install |
1033 | // Current rules: | 1010 | // Current rules: |
1034 | // If not installed - install | 1011 | // If not installed - install |
1035 | // If installed and different version available - upgrade | 1012 | // If installed and different version available - upgrade |
@@ -1147,17 +1124,34 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1147 | 1124 | ||
1148 | // User hit cancel (on dlg - assume remove) | 1125 | // User hit cancel (on dlg - assume remove) |
1149 | return item; | 1126 | return item; |
1150 | } | 1127 | } |
1151 | } | 1128 | } |
1152 | 1129 | ||
1153 | void MainWindow :: reloadData() | 1130 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1154 | { | 1131 | { |
1155 | stack->raiseWidget( progressWindow ); | 1132 | stack->raiseWidget( progressWindow ); |
1133 | |||
1134 | if ( dlg ) | ||
1135 | { | ||
1136 | dlg->close(); | ||
1137 | delete dlg; | ||
1138 | } | ||
1139 | |||
1156 | mgr->reloadServerData(); | 1140 | mgr->reloadServerData(); |
1157 | serverSelected( -1, FALSE ); | 1141 | serverSelected( -1, FALSE ); |
1142 | |||
1143 | #ifdef QWS | ||
1144 | m_status->setText( tr( "Updating Launcher..." ) ); | ||
1145 | |||
1146 | // Finally let the main system update itself | ||
1147 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
1148 | QString lf = QString::null; | ||
1149 | e << lf; | ||
1150 | #endif | ||
1151 | |||
1158 | stack->raiseWidget( networkPkgWindow ); | 1152 | stack->raiseWidget( networkPkgWindow ); |
1159 | } | 1153 | } |
1160 | 1154 | ||
1161 | void MainWindow :: letterPushed( QString t ) | 1155 | void MainWindow :: letterPushed( QString t ) |
1162 | { | 1156 | { |
1163 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1157 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |