|
5 | 5 | #include <QVBoxLayout> |
6 | 6 | #include <QRegularExpression> |
7 | 7 | #include <QPushButton> |
| 8 | +#include <QCheckBox> |
8 | 9 | #include <QtGlobal> |
9 | 10 | #include <QCoreApplication> |
10 | 11 | #include "RabbitCommonTools.h" |
@@ -35,6 +36,8 @@ qint16 CConnecterWakeOnLan::Version() |
35 | 36 |
|
36 | 37 | int CConnecterWakeOnLan::Initial() |
37 | 38 | { |
| 39 | + int nRet = CConnecter::Initial(); |
| 40 | + if(nRet) return nRet; |
38 | 41 | qDebug(log) << Q_FUNC_INFO; |
39 | 42 | bool check = false; |
40 | 43 | CPluginClient* plugin = GetPlugClient(); |
@@ -170,17 +173,21 @@ int CConnecterWakeOnLan::Connect() |
170 | 173 | static bool bShow = false; |
171 | 174 | if(!bShow) { |
172 | 175 | bShow = true; |
173 | | - int nRet = QMessageBox::warning( |
174 | | - nullptr, tr("Warning"), |
| 176 | + int nRet = 0; |
| 177 | + QMessageBox msg( |
| 178 | + QMessageBox::Warning, tr("Warning"), |
175 | 179 | tr("There are no administrator privileges, " |
176 | 180 | "and some functions(Get mac address) are restricted. " |
177 | 181 | "Please restart the program with administrative privileges."), |
178 | 182 | QMessageBox::Yes | QMessageBox::No); |
| 183 | + msg.setCheckBox(new QCheckBox(tr("Exit the program"), &msg)); |
| 184 | + msg.checkBox()->setCheckable(true); |
| 185 | + nRet = msg.exec(); |
179 | 186 | if(QMessageBox::Yes == nRet) { |
180 | 187 | bool bRet = RabbitCommon::CTools::executeByRoot( |
181 | 188 | QCoreApplication::applicationFilePath()); |
182 | 189 | qDebug(log) << "Execute:" << bRet << QCoreApplication::applicationFilePath(); |
183 | | - if(bRet) { |
| 190 | + if(bRet && msg.checkBox()->isChecked()) { |
184 | 191 | QCoreApplication::quit(); |
185 | 192 | } |
186 | 193 | } |
|
0 commit comments