Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
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();
}