Beispiel #1
0
void SettingsDialog::on_reloadCalendarListButton_clicked() {
    // we need to store the calendar backend
    storeSettings();

    OwnCloudService *ownCloud = new OwnCloudService(crypto, this);
    ownCloud->settingsGetCalendarList(this);
}
Beispiel #2
0
/**
 * @brief Updates the completed state of a calendar item on the ownCloud server
 * @param item
 */
void TodoDialog::on_todoList_itemChanged(QListWidgetItem *item) {
    qDebug() << __func__ << " - 'item': " << item;
    QString uid = item->data(Qt::UserRole).toString();

    CalendarItem calItem = CalendarItem::fetchByUid(uid);
    if (calItem.isFetched()) {
        calItem.updateCompleted(item->checkState() == Qt::Checked);
        calItem.store();

        OwnCloudService *ownCloud = OwnCloudService::instance();

        // post the calendar item to the server
        ownCloud->postCalendarItemToServer(calItem, this);
    }
}
Beispiel #3
0
void TodoDialog::on_saveButton_clicked() {
    MetricsService::instance()->sendEvent("todo list", "todo item stored");

    updateCurrentCalendarItemWithFormData();

    OwnCloudService *ownCloud = new OwnCloudService(crypto, this);

    // update the local icsData from server
    ownCloud->updateICSDataOfCalendarItem(&currentCalendarItem);

    // post the calendar item to the server
    ownCloud->postCalendarItemToServer(currentCalendarItem, this);

    qDebug() << currentCalendarItem;
}
Beispiel #4
0
void TodoDialog::on_newItemEdit_returnPressed() {
    CalendarItem calItem = CalendarItem::createNewTodoItem(
            ui->newItemEdit->text(),
            ui->todoListSelector->currentText());
    lastCreatedCalendarItem = calItem;

    OwnCloudService *ownCloud = new OwnCloudService(crypto, this);

    // post the calendar item to the server
    ownCloud->postCalendarItemToServer(calItem, this);

//    if ( calItem.isFetched() )
//    {
//        qDebug() << __func__ << " - 'calItem': " << calItem;
//        reloadTodoListItems();
//    }

    ui->newItemEdit->clear();
}
Beispiel #5
0
/**
 * @brief Removes the currently selected task from the ownCloud server
 */
void TodoDialog::on_removeButton_clicked() {
    if (Utils::Gui::question(
                this, tr("Remove todo item"),
                tr("Remove the selected todo item?\nThis cannot be undone!"),
                "remove-todo-items") == QMessageBox::Yes) {
        CalendarItem calItem = currentCalendarItem;

        // remove the calendar item from the list widget
        // (this will update the currentCalendarItem)
        ui->todoList->takeItem(ui->todoList->currentRow());

        // remove the calendar item from the database
        calItem.remove();

        // remove the calendar item from the ownCloud server
        // (this will reload the task list as well)
        OwnCloudService *ownCloud = OwnCloudService::instance();
        ownCloud->removeCalendarItem(calItem, this);
    }
}
Beispiel #6
0
void TodoDialog::on_saveButton_clicked() {
    MetricsService::instance()->sendVisitIfEnabled("todo/item/stored");

    updateCurrentCalendarItemWithFormData();

    OwnCloudService *ownCloud = OwnCloudService::instance();

    // update the local icsData from server
    ownCloud->updateICSDataOfCalendarItem(&currentCalendarItem);

    // post the calendar item to the server
    ownCloud->postCalendarItemToServer(currentCalendarItem, this);

    qDebug() << currentCalendarItem;

    QSettings settings;
    if (settings.value("closeTodoListAfterSave").toBool()) {
        close();
    }
}
Beispiel #7
0
/**
 * @brief Removes the currently selected todo list item from the ownCloud server
 */
void TodoDialog::on_removeButton_clicked() {
    if (QMessageBox::information(
            this, "Remove todo item",
            "Remove the selected todo item?\nThis cannot be undone!",
            "&Remove", "&Cancel", QString::null,
            0, 1) == 0) {
        CalendarItem calItem = currentCalendarItem;

        // remove the calendar item from the list widget
        // (this will update the currentCalendarItem)
        ui->todoList->takeItem(ui->todoList->currentRow());

        // remove the calendar item from the database
        calItem.remove();

        // remove the calendar item from the ownCloud server
        // (this will reload the todo list as well)
        OwnCloudService *ownCloud = new OwnCloudService(crypto, this);
        ownCloud->removeCalendarItem(calItem, this);
    }
}
Beispiel #8
0
void TodoDialog::on_newItemEdit_returnPressed() {
    CalendarItem calItem = CalendarItem::createNewTodoItem(
            ui->newItemEdit->text(),
            ui->todoListSelector->currentText());
    lastCreatedCalendarItem = calItem;

    // set the focus to the description edit after we loaded the tasks
    _setFocusToDescriptionEdit = true;

    OwnCloudService *ownCloud = OwnCloudService::instance();

    // post the calendar item to the server
    ownCloud->postCalendarItemToServer(calItem, this);

//    if ( calItem.isFetched() )
//    {
//        qDebug() << __func__ << " - 'calItem': " << calItem;
//        reloadTodoListItems();
//    }

    ui->newItemEdit->clear();
}
Beispiel #9
0
/**
 * @brief Starts a connection test
 */
void SettingsDialog::startConnectionTest() {
    ui->connectionTestLabel->hide();
    OwnCloudService *ownCloud = new OwnCloudService(crypto, this);
    ownCloud->settingsConnectionTest(this);
}
Beispiel #10
0
/**
 * @brief Fetches the items of the current task list from ownCloud
 */
void TodoDialog::reloadTodoList() {
    ui->todoItemLoadingProgressBar->setValue(0);
    ui->todoItemLoadingProgressBar->show();
    OwnCloudService *ownCloud = OwnCloudService::instance();
    ownCloud->todoGetTodoList(ui->todoListSelector->currentText(), this);
}