Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 640:626507197360 trustbridge-refactor
Updated mainwindow and handle certificate lists.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 24 Jun 2014 17:07:49 +0200 |
parents | 3a9c0f38bbad |
children | a7c3ab273d41 |
comparison
equal
deleted
inserted
replaced
639:c1b35edb097f | 640:626507197360 |
---|---|
57 #include "logging.h" | 57 #include "logging.h" |
58 | 58 |
59 MainWindow::MainWindow(bool trayMode): | 59 MainWindow::MainWindow(bool trayMode): |
60 mTrayMode(trayMode) | 60 mTrayMode(trayMode) |
61 { | 61 { |
62 mUpdatesNewSize = 0; | |
63 mUpdatesRemoveSize = 0; | |
64 mUpdatesManualSize = 0; | |
62 createActions(); | 65 createActions(); |
63 createTrayIcon(); | 66 createTrayIcon(); |
64 createContent(); | 67 createContent(); |
65 resize(950, 540); | 68 resize(950, 540); |
66 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); | 69 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode"); |
521 updatesManualLayout->addWidget(mUpdatesManualCertificates); | 524 updatesManualLayout->addWidget(mUpdatesManualCertificates); |
522 updatesManualLayout->addWidget(updatesDetailsManual); | 525 updatesManualLayout->addWidget(updatesDetailsManual); |
523 updatesManualLayout->insertStretch(2, 10); | 526 updatesManualLayout->insertStretch(2, 10); |
524 mUpdatesManual = new CertificateListWidget(this); | 527 mUpdatesManual = new CertificateListWidget(this); |
525 mUpdatesManual->hide(); | 528 mUpdatesManual->hide(); |
526 | 529 connect(mUpdatesManual, SIGNAL(certChanged(bool, const Certificate&)), |
527 updatesCenterLayout->addWidget(updatesTip); | 530 this, SLOT(removeFromManual(bool, const Certificate&))); |
528 updatesCenterLayout->addLayout(updatesNewLayout); | |
529 updatesCenterLayout->addWidget(mUpdatesNew); | |
530 updatesCenterLayout->addLayout(updatesRemoveLayout); | |
531 updatesCenterLayout->addWidget(mUpdatesRemove); | |
532 updatesCenterLayout->addLayout(updatesManualLayout); | |
533 updatesCenterLayout->addWidget(mUpdatesManual); | |
534 | 531 |
535 QHBoxLayout *updatesBottomLayout = new QHBoxLayout; | 532 QHBoxLayout *updatesBottomLayout = new QHBoxLayout; |
536 quitButton = new QPushButton(tr("Quit without saving")); | 533 quitButton = new QPushButton(tr("Quit without saving")); |
537 QPushButton *saveButton = new QPushButton(tr("Update")); | 534 QPushButton *saveButton = new QPushButton(tr("Update")); |
538 connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp())); | 535 connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp())); |
539 connect(saveButton, SIGNAL(clicked()), this, SLOT(installCerts())); | 536 connect(saveButton, SIGNAL(clicked()), this, SLOT(installCerts())); |
540 updatesBottomLayout->insertStretch(0, 10); | 537 updatesBottomLayout->insertStretch(0, 10); |
541 updatesBottomLayout->addWidget(saveButton); | 538 updatesBottomLayout->addWidget(saveButton); |
542 updatesBottomLayout->addWidget(quitButton); | 539 updatesBottomLayout->addWidget(quitButton); |
540 updatesBottomLayout->setAlignment(Qt::AlignBottom); | |
541 | |
542 updatesNewLayout->setAlignment(Qt::AlignTop); | |
543 updatesRemoveLayout->setAlignment(Qt::AlignTop); | |
544 updatesManualLayout->setAlignment(Qt::AlignTop); | |
545 updatesCenterLayout->addWidget(updatesTip, 0, Qt::AlignTop); | |
546 updatesCenterLayout->addLayout(updatesNewLayout); | |
547 // updatesCenterLayout->setStretchFactor(updatesNewLayout, 100); | |
548 updatesCenterLayout->addWidget(mUpdatesNew, 1, Qt::AlignTop); | |
549 updatesCenterLayout->addLayout(updatesRemoveLayout); | |
550 // updatesCenterLayout->setStretchFactor(updatesRemoveLayout, 100); | |
551 updatesCenterLayout->addWidget(mUpdatesRemove, 1, Qt::AlignTop); | |
552 updatesCenterLayout->addLayout(updatesManualLayout); | |
553 // updatesCenterLayout->setStretchFactor(updatesManualLayout, 100); | |
554 updatesCenterLayout->addWidget(mUpdatesManual, 1, Qt::AlignTop); | |
555 updatesCenterLayout->insertStretch(7, 0); | |
556 updatesCenterLayout->addLayout(updatesBottomLayout); | |
557 | |
543 | 558 |
544 QFrame *updatesPanelSeparator = new QFrame(); | 559 QFrame *updatesPanelSeparator = new QFrame(); |
545 updatesPanelSeparator->setFrameShape(QFrame::HLine); | 560 updatesPanelSeparator->setFrameShape(QFrame::HLine); |
546 updatesPanelSeparator->setFrameShadow(QFrame::Sunken); | 561 updatesPanelSeparator->setFrameShadow(QFrame::Sunken); |
547 updatesPanelLayout->addLayout(updatesHeaderLayout); | 562 updatesPanelLayout->addLayout(updatesHeaderLayout); |
548 updatesPanelLayout->addWidget(updatesPanelSeparator); | 563 updatesPanelLayout->addWidget(updatesPanelSeparator); |
549 updatesPanelLayout->addLayout(updatesCenterLayout); | 564 updatesPanelLayout->addLayout(updatesCenterLayout); |
550 updatesPanelLayout->insertStretch(3, 10); | 565 updatesPanelLayout->setStretchFactor(updatesCenterLayout, 1); |
551 updatesPanelLayout->addLayout(updatesBottomLayout); | 566 //updatesPanelLayout->insertStretch(3, 2); |
567 //updatesPanelLayout->addLayout(updatesBottomLayout); | |
552 mUpdatesWidget->setLayout(updatesPanelLayout); | 568 mUpdatesWidget->setLayout(updatesPanelLayout); |
553 mUpdatesWidget->setMinimumSize(QSize(820, 440)); | 569 mUpdatesWidget->setMinimumSize(QSize(820, 440)); |
554 mUpdatesPanel->setWidget(mUpdatesWidget); | 570 mUpdatesPanel->setWidget(mUpdatesWidget); |
555 | 571 |
556 // Panel for trusted certificates. | 572 // Panel for trusted certificates. |
572 " you want to trust. TrustBridge will install these certificates for" | 588 " you want to trust. TrustBridge will install these certificates for" |
573 " secure communication via email or the internet (e.g. IE, Firefox," | 589 " secure communication via email or the internet (e.g. IE, Firefox," |
574 " Thunderbird)")); | 590 " Thunderbird)")); |
575 installCenterLayout->addWidget(installCenterText); | 591 installCenterLayout->addWidget(installCenterText); |
576 mInstallList = new CertificateListWidget(this); | 592 mInstallList = new CertificateListWidget(this); |
593 connect(mInstallList, SIGNAL(certChanged(bool, const Certificate&)), | |
594 this, SLOT(toggleInManual(bool, const Certificate&))); | |
577 | 595 |
578 installPanelLayout->addLayout(installHeaderLayout); | 596 installPanelLayout->addLayout(installHeaderLayout); |
579 installPanelLayout->addLayout(installCenterLayout); | 597 installPanelLayout->addLayout(installCenterLayout); |
580 installPanelLayout->addWidget(mInstallList); | 598 installPanelLayout->addWidget(mInstallList); |
581 mInstallPanel->setLayout(installPanelLayout); | 599 mInstallPanel->setLayout(installPanelLayout); |
596 | 614 |
597 QLabel *removeCenterText = new QLabel(tr("Please choose the certificates" | 615 QLabel *removeCenterText = new QLabel(tr("Please choose the certificates" |
598 " you want to remove. TrustBridge will remove these certificates.")); | 616 " you want to remove. TrustBridge will remove these certificates.")); |
599 removeCenterLayout->addWidget(removeCenterText); | 617 removeCenterLayout->addWidget(removeCenterText); |
600 mRemoveList = new CertificateListWidget(this); | 618 mRemoveList = new CertificateListWidget(this); |
619 connect(mRemoveList, SIGNAL(certChanged(bool, const Certificate&)), | |
620 this, SLOT(toggleInManual(bool, const Certificate&))); | |
601 | 621 |
602 removePanelLayout->addLayout(removeHeaderLayout); | 622 removePanelLayout->addLayout(removeHeaderLayout); |
603 removePanelLayout->addLayout(removeCenterLayout); | 623 removePanelLayout->addLayout(removeCenterLayout); |
604 removePanelLayout->addWidget(mRemoveList); | 624 removePanelLayout->addWidget(mRemoveList); |
605 mRemovePanel->setLayout(removePanelLayout); | 625 mRemovePanel->setLayout(removePanelLayout); |
812 void MainWindow::loadCertificateList() | 832 void MainWindow::loadCertificateList() |
813 { | 833 { |
814 //mCertListWidget->clear(); | 834 //mCertListWidget->clear(); |
815 //int i = 0; | 835 //int i = 0; |
816 | 836 |
817 qDebug() << "loading list"; | |
818 /* TODO: if nothing is available (neither old nor new) add some progress | 837 /* TODO: if nothing is available (neither old nor new) add some progress |
819 * indication */ | 838 * indication */ |
820 mInstallList->clear(); | 839 mInstallList->clear(); |
821 mUpdatesNew->clear(); | 840 mUpdatesNew->clear(); |
822 mRemoveList->clear(); | 841 mRemoveList->clear(); |
826 QList<Certificate> oldInstallCerts; | 845 QList<Certificate> oldInstallCerts; |
827 QList<Certificate> oldRemoveCerts; | 846 QList<Certificate> oldRemoveCerts; |
828 | 847 |
829 if (mListToInstall.getCertificates().isEmpty()) { | 848 if (mListToInstall.getCertificates().isEmpty()) { |
830 // No new list available, add old certificates. | 849 // No new list available, add old certificates. |
831 qDebug() << "no new list..."; | |
832 foreach (const Certificate &cert, mInstalledList.getCertificates()) { | 850 foreach (const Certificate &cert, mInstalledList.getCertificates()) { |
851 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); | |
833 if (cert.isInstallCert()) { | 852 if (cert.isInstallCert()) { |
834 oldInstallCerts.append(cert); | 853 oldInstallCerts.append(cert); |
835 mInstallList->addCertificate(cert); | 854 mInstallList->addCertificate(cert, state); |
836 } | 855 } |
837 else { | 856 else { |
838 oldRemoveCerts.append(cert); | 857 oldRemoveCerts.append(cert); |
839 mRemoveList->addCertificate(cert); | 858 mRemoveList->addCertificate(cert, state, !state); |
840 } | 859 } |
841 } | 860 } |
842 qDebug() << "old list date: " << mInstalledList.date().toString(); | |
843 // Set the date of the old list. | 861 // Set the date of the old list. |
844 // mCurrentListDate->setText(tr("Current List Date: %1") | 862 // mCurrentListDate->setText(tr("Current List Date: %1") |
845 // .arg(mInstalledList.date().toString())); | 863 // .arg(mInstalledList.date().toString())); |
846 } | 864 } |
847 else { | 865 else { |
848 qDebug() << "new list available"; | |
849 // Sort and filter both lists. | 866 // Sort and filter both lists. |
850 foreach (const Certificate &cert, mListToInstall.getCertificates()) { | 867 foreach (const Certificate &cert, mListToInstall.getCertificates()) { |
868 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); | |
851 if (cert.isInstallCert()) { | 869 if (cert.isInstallCert()) { |
852 // Certificate with status "install". | 870 // Certificate with status "install". |
853 if (mInstalledList.getCertificates().contains(cert)) { | 871 if (mInstalledList.getCertificates().contains(cert)) { |
854 // Was in the old list. | 872 // Was in the old list. |
855 oldInstallCerts.append(cert); | 873 oldInstallCerts.append(cert); |
856 qDebug() << "add install"; | 874 mInstallList->addCertificate(cert, state); |
857 mInstallList->addCertificate(cert); | |
858 } | 875 } |
859 else { | 876 else { |
860 // Is a brand new certificate | 877 // Is a brand new certificate |
861 newInstallCerts.append(cert); | 878 newInstallCerts.append(cert); |
862 qDebug() << "add new install"; | 879 mUpdatesNew->addCertificate(cert, state); |
863 mUpdatesNew->addCertificate(cert); | |
864 } | 880 } |
865 } | 881 } |
866 else { | 882 else { |
867 // Certificate with status "remove". | 883 // Certificate with status "remove". |
868 if (mInstalledList.getCertificates().contains(cert)) { | 884 if (mInstalledList.getCertificates().contains(cert)) { |
869 // Was in the old list. | 885 // Was in the old list. |
870 oldRemoveCerts.append(cert); | 886 oldRemoveCerts.append(cert); |
871 qDebug() << "add remove"; | 887 // Is removed, so set editable to false. |
872 mRemoveList->addCertificate(cert); | 888 mRemoveList->addCertificate(cert, state, !state); |
873 } | 889 } |
874 else { | 890 else { |
875 // Was in the old list with status "install" and now has the | 891 // Was in the old list with status "install" and now has the |
876 // status "remove". | 892 // status "remove". |
877 newRemoveCerts.append(cert); | 893 newRemoveCerts.append(cert); |
878 qDebug() << "add new remove"; | 894 mUpdatesRemove->addCertificate(cert, state); |
879 mUpdatesRemove->addCertificate(cert); | |
880 } | 895 } |
881 } | 896 } |
882 } | 897 } |
883 mUpdatesHeader->setText("<h2>" + | 898 mUpdatesHeader->setText("<h2>" + |
884 tr("Updates (%1/%2)") | 899 tr("Updates (%1/%2)") |
885 .arg(newRemoveCerts.size() + newInstallCerts.size()) | 900 .arg(mUpdatesNew->selectedCertCount() + mUpdatesRemove->selectedCertCount()) |
886 .arg(newRemoveCerts.size() + newInstallCerts.size()) + "</h2>"); | 901 .arg(newRemoveCerts.size() + newInstallCerts.size()) + "</h2>"); |
887 mLastCertUpdate->setText(tr("Last certificate update: %1") | 902 mLastCertUpdate->setText(tr("Last certificate update: %1") |
888 .arg(mInstalledList.date().toString())); | 903 .arg(mInstalledList.date().toString())); |
889 /* mCurrentListDate->setText(tr("Current List Date: %1") | 904 /* mCurrentListDate->setText(tr("Current List Date: %1") |
890 .arg(mInstalledList.date().toString())); | 905 .arg(mInstalledList.date().toString())); |
1031 loadCertificateList(); | 1046 loadCertificateList(); |
1032 } | 1047 } |
1033 | 1048 |
1034 void MainWindow::installCerts() { | 1049 void MainWindow::installCerts() { |
1035 QStringList choices; | 1050 QStringList choices; |
1036 | 1051 QStringList unselected; |
1037 choices << mUpdatesNew->certificates(); | 1052 |
1038 choices << mUpdatesRemove->certificates(); | 1053 choices << mUpdatesNew->selectedCertificates(); |
1039 choices << mUpdatesManual->certificates(); | 1054 choices << mUpdatesRemove->selectedCertificates(); |
1055 | |
1056 choices << mUpdatesManual->selectedCertificates(); | |
1057 QStringList unselectedManuals = mUpdatesManual->unselectedCertificates(); | |
1058 for(int i = 0; i < unselectedManuals.size(); i++) { | |
1059 if (unselectedManuals.at(i).startsWith("I:")) { | |
1060 QString certLine = unselectedManuals.at(i); | |
1061 certLine[0] = 'R'; | |
1062 choices << certLine; | |
1063 } | |
1064 } | |
1065 | |
1066 unselected << mUpdatesNew->unselectedCertificates(); | |
1067 unselected << mUpdatesRemove->unselectedCertificates(); | |
1068 unselected << mInstallList->unselectedCertificates(); | |
1069 unselected << mRemoveList->unselectedCertificates(); | |
1040 | 1070 |
1041 /* for (int i = 0; i < mCertListWidget->count(); i++) { | 1071 /* for (int i = 0; i < mCertListWidget->count(); i++) { |
1042 QListWidgetItem *item = mCertListWidget->item(i); | 1072 QListWidgetItem *item = mCertListWidget->item(i); |
1043 if (item->checkState() == Qt::Checked) { | 1073 if (item->checkState() == Qt::Checked) { |
1044 choices << item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line(); | 1074 choices << item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line(); |
1071 connect(instWrap, SIGNAL(installationSuccessful()), | 1101 connect(instWrap, SIGNAL(installationSuccessful()), |
1072 this, SLOT(installerSuccess())); | 1102 this, SLOT(installerSuccess())); |
1073 connect(instWrap, SIGNAL(error(const QString &)), | 1103 connect(instWrap, SIGNAL(error(const QString &)), |
1074 this, SLOT(installerError(const QString &))); | 1104 this, SLOT(installerError(const QString &))); |
1075 instWrap->start(); | 1105 instWrap->start(); |
1076 /* | 1106 |
1077 if (!saveUnselectedCertificates()) { | 1107 if (!saveUnselectedCertificates(unselected)) { |
1078 qWarning() << "Failed to save previosly unselected certificates."; | 1108 qWarning() << "Failed to save previosly unselected certificates."; |
1079 } | 1109 } |
1080 */ | 1110 |
1081 } | 1111 } |
1082 | 1112 |
1083 void MainWindow::loadUnselectedCertificates() | 1113 void MainWindow::loadUnselectedCertificates() |
1084 { | 1114 { |
1085 mPreviouslyUnselected.clear(); | 1115 mPreviouslyUnselected.clear(); |
1089 mPreviouslyUnselected << mSettings.value(key, QString()).toString(); | 1119 mPreviouslyUnselected << mSettings.value(key, QString()).toString(); |
1090 } | 1120 } |
1091 mSettings.endGroup(); | 1121 mSettings.endGroup(); |
1092 } | 1122 } |
1093 | 1123 |
1094 bool MainWindow::saveUnselectedCertificates() | 1124 bool MainWindow::saveUnselectedCertificates(QStringList unselected) |
1095 { | 1125 { |
1096 mPreviouslyUnselected.clear(); | 1126 mPreviouslyUnselected.clear(); |
1097 mSettings.beginGroup("unselected"); | 1127 mSettings.beginGroup("unselected"); |
1098 mSettings.remove(""); /* Clears old choices */ | 1128 mSettings.remove(""); /* Clears old choices */ |
1099 for (int i = 0; i < mCertListWidget->count(); i++) { | 1129 for (int i = 0; i < unselected.size(); i++) { |
1100 QListWidgetItem *item = mCertListWidget->item(i); | 1130 QString key = QString::fromLatin1("cert%1").arg(i); |
1101 if (item->checkState() != Qt::Checked && | 1131 QString value = unselected.at(i); |
1102 (item->flags() & Qt::ItemIsUserCheckable)) { | 1132 mSettings.setValue(key, value); |
1103 QString key = QString::fromLatin1("cert%1").arg(i); | 1133 mPreviouslyUnselected << value; |
1104 QString value = | |
1105 item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line(); | |
1106 mSettings.setValue(key, value); | |
1107 mPreviouslyUnselected << value; | |
1108 } | |
1109 } | 1134 } |
1110 mSettings.endGroup(); | 1135 mSettings.endGroup(); |
1111 mSettings.sync(); | 1136 mSettings.sync(); |
1112 return mSettings.status() == QSettings::NoError; | 1137 return mSettings.status() == QSettings::NoError; |
1113 } | 1138 } |
1124 mSettings.beginGroup("settings"); | 1149 mSettings.beginGroup("settings"); |
1125 mSettings.setValue("autostart", state != Qt::Unchecked); | 1150 mSettings.setValue("autostart", state != Qt::Unchecked); |
1126 mSettings.endGroup(); | 1151 mSettings.endGroup(); |
1127 } | 1152 } |
1128 | 1153 |
1154 void MainWindow::toggleInManual(bool state, const Certificate &cert) | |
1155 { | |
1156 if (!mUpdatesManual->contains(cert)) { | |
1157 mUpdatesManual->addCertificate(cert, state); | |
1158 } | |
1159 else { | |
1160 mUpdatesManual->removeCertificate(cert); | |
1161 } | |
1162 | |
1163 mUpdatesManualCertificates->setText("<h3>" + | |
1164 tr("Manualy changed Certificates (%1)") | |
1165 .arg(mUpdatesManual->certificates().size()) + | |
1166 "</h3>"); | |
1167 } | |
1168 | |
1169 void MainWindow::removeFromManual(bool state, const Certificate &cert) | |
1170 { | |
1171 mUpdatesManual->removeCertificate(cert); | |
1172 | |
1173 mUpdatesManualCertificates->setText("<h3>" + | |
1174 tr("Manualy changed Certificates (%1)") | |
1175 .arg(mUpdatesManual->certificates().size()) + | |
1176 "</h3>"); | |
1177 | |
1178 if (cert.isInstallCert()) { | |
1179 mInstallList->setCertState(state, cert); | |
1180 } | |
1181 else { | |
1182 mRemoveList->setCertState(state, cert); | |
1183 } | |
1184 } | |
1185 | |
1129 void MainWindow::closeApp() | 1186 void MainWindow::closeApp() |
1130 { | 1187 { |
1131 //saveUnselectedCertificates(); | |
1132 qApp->quit(); | 1188 qApp->quit(); |
1133 } | 1189 } |
1134 | 1190 |
1135 void MainWindow::togglePages(int button) | 1191 void MainWindow::togglePages(int button) |
1136 { | 1192 { |
1149 } | 1205 } |
1150 | 1206 |
1151 void MainWindow::toggleUpdatesNew() { | 1207 void MainWindow::toggleUpdatesNew() { |
1152 QSize old = mUpdatesWidget->size(); | 1208 QSize old = mUpdatesWidget->size(); |
1153 if (!mUpdatesNew->isVisible()) { | 1209 if (!mUpdatesNew->isVisible()) { |
1154 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesNew->height()); | |
1155 mUpdatesNew->show(); | 1210 mUpdatesNew->show(); |
1211 if (mUpdatesNewSize == 0) { | |
1212 mUpdatesNewSize = mUpdatesNew->height(); | |
1213 } | |
1214 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesNewSize); | |
1156 } | 1215 } |
1157 else { | 1216 else { |
1158 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height()); | 1217 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height()); |
1159 mUpdatesNew->hide(); | 1218 mUpdatesNew->hide(); |
1160 } | 1219 } |
1161 } | 1220 } |
1162 | 1221 |
1163 void MainWindow::toggleUpdatesRemove() { | 1222 void MainWindow::toggleUpdatesRemove() { |
1164 QSize old = mUpdatesWidget->size(); | 1223 QSize old = mUpdatesWidget->size(); |
1165 if (!mUpdatesRemove->isVisible()) { | 1224 if (!mUpdatesRemove->isVisible()) { |
1166 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesRemove->height()); | |
1167 mUpdatesRemove->show(); | 1225 mUpdatesRemove->show(); |
1226 if (mUpdatesRemoveSize == 0) { | |
1227 mUpdatesRemoveSize = mUpdatesRemove->height(); | |
1228 } | |
1229 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesRemoveSize); | |
1168 } | 1230 } |
1169 else { | 1231 else { |
1170 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height()); | 1232 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height()); |
1171 mUpdatesRemove->hide(); | 1233 mUpdatesRemove->hide(); |
1172 } | 1234 } |
1173 } | 1235 } |
1174 | 1236 |
1175 void MainWindow::toggleUpdatesManual() { | 1237 void MainWindow::toggleUpdatesManual() { |
1176 QSize old = mUpdatesWidget->size(); | 1238 QSize old = mUpdatesWidget->size(); |
1177 if (!mUpdatesManual->isVisible()) { | 1239 if (!mUpdatesManual->isVisible()) { |
1178 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesManual->height()); | |
1179 mUpdatesManual->show(); | 1240 mUpdatesManual->show(); |
1241 if (mUpdatesManualSize == 0) { | |
1242 mUpdatesManualSize = mUpdatesManual->height(); | |
1243 } | |
1244 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesManualSize); | |
1180 } | 1245 } |
1181 else { | 1246 else { |
1247 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height()); | |
1182 mUpdatesManual->hide(); | 1248 mUpdatesManual->hide(); |
1183 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height()); | 1249 } |
1184 } | 1250 } |
1185 } |