Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 0102292..0efa1e0 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -957,7 +957,11 @@ void MainWindow :: applyChanges() | |||
957 | { | 957 | { |
958 | if ( item->isOn() ) | 958 | if ( item->isOn() ) |
959 | { | 959 | { |
960 | workingPackages.append( dealWithItem( item ) ); | 960 | InstallData *instdata = dealWithItem( item ); |
961 | if ( instdata ) | ||
962 | workingPackages.append( instdata ); | ||
963 | else | ||
964 | return; | ||
961 | } | 965 | } |
962 | } | 966 | } |
963 | 967 | ||
@@ -1067,14 +1071,19 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1067 | { | 1071 | { |
1068 | QString msgtext; | 1072 | QString msgtext; |
1069 | msgtext = caption.arg( ( const char * )name ); | 1073 | msgtext = caption.arg( ( const char * )name ); |
1070 | switch( QMessageBox::information( this, text, | 1074 | // switch( QMessageBox::information( this, text, |
1071 | msgtext, tr( "Remove" ), secondButton ) ) | 1075 | // msgtext, tr( "Remove" ), secondButton ) ) |
1076 | QuestionDlg dlg( text, msgtext, secondButton ); | ||
1077 | switch( dlg.exec() ) | ||
1072 | { | 1078 | { |
1073 | case 0: // Try again or Enter | 1079 | case 0: // Cancel |
1074 | // option 0 = Remove | 1080 | delete newitem; |
1081 | return 0x0; | ||
1082 | break; | ||
1083 | case 1: // Remove | ||
1075 | newitem->option = "D"; | 1084 | newitem->option = "D"; |
1076 | break; | 1085 | break; |
1077 | case 1: // Quit or Escape | 1086 | case 2: // Reinstall or Upgrade |
1078 | newitem->option = secondOption; | 1087 | newitem->option = secondOption; |
1079 | break; | 1088 | break; |
1080 | } | 1089 | } |
@@ -1164,3 +1173,51 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) | |||
1164 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); | 1173 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); |
1165 | p->showMaximized(); | 1174 | p->showMaximized(); |
1166 | } | 1175 | } |
1176 | |||
1177 | QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) | ||
1178 | : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) | ||
1179 | { | ||
1180 | setCaption( caption ); | ||
1181 | resize( 175, 100 ); | ||
1182 | |||
1183 | QGridLayout *layout = new QGridLayout( this ); | ||
1184 | |||
1185 | QLabel *l = new QLabel( text, this ); | ||
1186 | l->setAlignment( AlignCenter | WordBreak ); | ||
1187 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); | ||
1188 | |||
1189 | btn1 = new QPushButton( tr( "Remove" ), this ); | ||
1190 | connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | ||
1191 | layout->addWidget( btn1, 1, 0 ); | ||
1192 | |||
1193 | btn2 = new QPushButton( secondbtn, this ); | ||
1194 | connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | ||
1195 | layout->addWidget( btn2, 1, 1 ); | ||
1196 | |||
1197 | executing = FALSE; | ||
1198 | } | ||
1199 | |||
1200 | int QuestionDlg::exec() | ||
1201 | { | ||
1202 | show(); | ||
1203 | |||
1204 | if ( !executing ) | ||
1205 | { | ||
1206 | executing = TRUE; | ||
1207 | qApp->enter_loop(); | ||
1208 | } | ||
1209 | |||
1210 | return buttonpressed; | ||
1211 | } | ||
1212 | |||
1213 | void QuestionDlg::slotButtonPressed() | ||
1214 | { | ||
1215 | if ( sender() == btn1 ) | ||
1216 | buttonpressed = 1; | ||
1217 | else if ( sender() == btn2 ) | ||
1218 | buttonpressed = 2; | ||
1219 | else | ||
1220 | buttonpressed = 0; | ||
1221 | |||
1222 | qApp->exit_loop(); | ||
1223 | } | ||