void MainWindow::editActivity(QSharedPointer<Activity> activity) { bool wasRunning = activity->isRunning(); ActivityDialog *dialog = new ActivityDialog(activity, this); dialog->setActivityCompleter(m_activityCompleter); dialog->setTagCompleter(m_tagCompleter); dialog->setModal(true); if (dialog->exec() == QDialog::Accepted) { if (!wasRunning && activity->isRunning()) { stopCurrentActivities(); } activity->save(); } dialog->deleteLater(); }
void MainWindow::on_btnAddEarlierActivity_clicked() { ActivityDialog *dialog = new ActivityDialog(this); dialog->setActivityCompleter(m_activityCompleter); dialog->setTagCompleter(m_tagCompleter); dialog->setModal(true); if (dialog->exec() == QDialog::Accepted) { QSharedPointer<Activity> activity = dialog->activity(); if (activity->isRunning()) { stopCurrentActivities(); } activity->save(); m_recordManager->addRecordPointer(activity); emit activityCreated(activity); refreshCompleterModels(); } dialog->deleteLater(); }
void AccountActionsManager::handleAccountSetActivity () { IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO); if (!account) return; QObject *obj = sender ()->property ("Azoth/AccountObject").value<QObject*> (); ISupportActivity *activity = qobject_cast<ISupportActivity*> (obj); if (!activity) { qWarning () << Q_FUNC_INFO << obj << "doesn't support activity"; return; } ActivityDialog dia (MW_); if (dia.exec () != QDialog::Accepted) return; activity->SetActivity (dia.GetGeneral (), dia.GetSpecific (), dia.GetText ()); }