MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / slotNew

Method slotNew

App/Client/Recent/FrmRecent.cpp:309–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void CFrmRecent::slotNew()
310{
311 QAction* pAction = dynamic_cast<QAction*>(this->sender());
312 if(!pAction || pAction->data().toString().isEmpty())
313 return;
314 COperate* pOperate = m_pManager->CreateOperate(pAction->data().toString());
315 if(nullptr == pOperate) return;
316
317 int nRet = pOperate->OpenDialogSettings(this);
318 switch(nRet)
319 {
320 case QDialog::Rejected:
321 break;
322 case QDialog::Accepted:
323 {
324 QString szFile = pOperate->GetSettingsFile();
325 QDir d;
326 if(d.exists(szFile)) {
327 QMessageBox::StandardButton ret
328 = QMessageBox::warning(
329 this, tr("Warning"),
330 tr("The file is exists. whether to overwrite it?\nFile: %1").arg(szFile),
331 QMessageBox::StandardButton::Ok | QMessageBox::StandardButton::No,
332 QMessageBox::StandardButton::No);
333 if(QMessageBox::StandardButton::Ok != ret)
334 {
335 break;
336 }
337 }
338
339 int nRet = 0;
340 bool bRet = QMetaObject::invokeMethod(
341 m_pMainWindow,
342 "Start",
343 Qt::DirectConnection,
344 Q_RETURN_ARG(int, nRet),
345 Q_ARG(COperate*, pOperate),
346 Q_ARG(bool, false),
347 Q_ARG(QString, szFile)
348 );
349 if(!bRet)
350 qCritical(log) << "Failed to call MainWindow::Start()";
351 return;
352 }
353 }
354
355 m_pManager->DeleteOperate(pOperate);
356}
357
358void CFrmRecent::slotEdit()
359{

Callers

nothing calls this directly

Calls 6

OpenDialogSettingsMethod · 0.80
GetSettingsFileMethod · 0.80
isEmptyMethod · 0.45
dataMethod · 0.45
CreateOperateMethod · 0.45
DeleteOperateMethod · 0.45

Tested by

no test coverage detected