当前位置: 首页>>代码示例>>C++>>正文


C++ CalendarItem类代码示例

本文整理汇总了C++中CalendarItem的典型用法代码示例。如果您正苦于以下问题:C++ CalendarItem类的具体用法?C++ CalendarItem怎么用?C++ CalendarItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CalendarItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: qDebug

/**
 * Jumps to a task
 *
 * @param taskUid
 */
void TodoDialog::jumpToTask(QString taskUid) {
    if (taskUid.isEmpty()) {
        return;
    }

    CalendarItem calendarItem = CalendarItem::fetchByUid(taskUid);
    qDebug() << __func__ << " - 'calendarItem': " << calendarItem;

    if (calendarItem.exists()) {
        // set a calendar item uid to jump to later on
        _jumpToCalendarItemUid = taskUid;

        QString calendar = calendarItem.getCalendar();

        // if the calendar of the calendar item isn't the current one we
        // have to switch to it
        if (ui->todoListSelector->currentText() != calendar) {
            // select the correct calendar and then jump to the task item
            ui->todoListSelector->setCurrentText(calendar);
        } else {
            // jump directly to the correct task item
            jumpToTodoListItem();
        }
    }
}
开发者ID:pbek,项目名称:QOwnNotes,代码行数:30,代码来源:tododialog.cpp

示例2: overlap

bool HourRangeNode::overlap(const CalendarItem &item1, const CalendarItem &item2) const {
	QPair<int, int> verti1 = getItemTopAndHeight(item1.beginning().time(), item1.ending().time(), m_hourHeight, m_minimumItemHeight);
	QPair<int, int> verti2 = getItemTopAndHeight(item2.beginning().time(), item2.ending().time(), m_hourHeight, m_minimumItemHeight);

	QRect rect1(0, verti1.first, 10, verti1.second);
	QRect rect2(0, verti2.first, 10, verti2.second);
	return rect1.intersects(rect2);
}
开发者ID:Dinesh-Ramakrishnan,项目名称:freemedforms,代码行数:8,代码来源:hour_range_node.cpp

示例3: fetchAllForReminderAlert

/**
 * @brief Shows alerts for calendar items with an alarm date in the current minute
 */
void CalendarItem::alertTodoReminders() {
    QList<CalendarItem> calendarItemList = fetchAllForReminderAlert();

    QListIterator<CalendarItem> itr(calendarItemList);
    while (itr.hasNext()) {
        CalendarItem calItem = itr.next();
        QMessageBox::information(NULL, "Reminder", "Reminder: <strong>" + calItem.getSummary() + "</strong>");
    }
}
开发者ID:Fabijenna,项目名称:QOwnNotes,代码行数:12,代码来源:calendaritem.cpp

示例4: fetchAll

/**
 * @brief Updates all priorities of calendar items
 */
void CalendarItem::updateAllSortPriorities() {
    QList<CalendarItem> calendarItemList = fetchAll();

    QListIterator<CalendarItem> itr(calendarItemList);
    while (itr.hasNext()) {
        CalendarItem calItem = itr.next();
        calItem.updateSortPriority();
        calItem.store();
    }
}
开发者ID:Fabijenna,项目名称:QOwnNotes,代码行数:13,代码来源:calendaritem.cpp

示例5: painter

void DayWidget::paintEvent(QPaintEvent *)
{
        QPainter painter(this);
	painter.setRenderHint(QPainter::Antialiasing);
	painter.setPen(Qt::NoPen);
	QBrush brush = painter.brush();
	brush.setStyle(Qt::SolidPattern);
	brush.setColor(QColor(0, 150, 0, m_inMotion ? 200 : 255));
	painter.setBrush(brush);

	painter.drawRoundedRect(rect(), 4, 4);
	painter.setPen(Qt::white);
	if (model()) {
		CalendarItem item = model()->getItemByUid(uid());
		painter.drawText(rect().adjusted(2, 0, -2, 0), Qt::AlignVCenter | Qt::AlignLeft, item.title().isEmpty() ? tr("(untitled)") : item.title());
	}
}
开发者ID:NyFanomezana,项目名称:freemedforms,代码行数:17,代码来源:day_widget.cpp

示例6: fetchByUrl

CalendarItem CalendarItem::fetchByUrl(QUrl url) {
    CalendarItem calendarItem;
    QSqlDatabase db = QSqlDatabase::database("disk");
    QSqlQuery query(db);

    query.prepare("SELECT * FROM calendarItem WHERE url = :url");
    query.bindValue(":url", url);

    if (!query.exec()) {
        qWarning() << __func__ << ": " << query.lastError();
    }
    else if (query.first()) {
        calendarItem.fillFromQuery(query);
    }

    return calendarItem;
}
开发者ID:Fabijenna,项目名称:QOwnNotes,代码行数:17,代码来源:calendaritem.cpp

示例7: query

CalendarItem CalendarItem::fetch(int id) {
    QSqlDatabase db = QSqlDatabase::database("disk");
    QSqlQuery query(db);

    CalendarItem calendarItem;

    query.prepare("SELECT * FROM calendarItem WHERE id = :id");
    query.bindValue(":id", id);

    if (!query.exec()) {
        qWarning() << __func__ << ": " << query.lastError();
    }
    else if (query.first()) {
        calendarItem.fillFromQuery(query);
    }

    return calendarItem;
}
开发者ID:Fabijenna,项目名称:QOwnNotes,代码行数:18,代码来源:calendaritem.cpp

示例8: tr

/**
 * @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);
    }
}
开发者ID:pbek,项目名称:QOwnNotes,代码行数:23,代码来源:tododialog.cpp

示例9: postCalendarItemToServer

void OwnCloudService::postCalendarItemToServer(CalendarItem calendarItem,
                                               TodoDialog *dialog) {
    this->todoDialog = dialog;

    calendarItem.generateNewICSData();

    QUrl url(calendarItem.getUrl());
    QNetworkRequest r;
    addAuthHeader(&r);
    r.setUrl(url);

    // build the request body
    QString body = calendarItem.getICSData();

    QByteArray *dataToSend = new QByteArray(body.toLatin1());
    r.setHeader(QNetworkRequest::ContentLengthHeader, dataToSend->size());
    QBuffer *buffer = new QBuffer(dataToSend);

    QNetworkReply *reply = networkManager->sendCustomRequest(r, "PUT", buffer);
    ignoreSslErrorsIfAllowed(reply);
}
开发者ID:hckweb,项目名称:QOwnNotes,代码行数:21,代码来源:owncloudservice.cpp

示例10: removeCalendarItem

/**
 * @brief Removes a todo list item from the ownCloud server
 */
void OwnCloudService::removeCalendarItem(CalendarItem calItem,
                                         TodoDialog *dialog) {
    this->todoDialog = dialog;
    this->calendarName = calendarName;

    QUrl url(calItem.getUrl());
    QNetworkRequest r(url);
    addAuthHeader(&r);

    QNetworkReply *reply = networkManager->sendCustomRequest(r, "DELETE");
    ignoreSslErrorsIfAllowed(reply);
}
开发者ID:hckweb,项目名称:QOwnNotes,代码行数:15,代码来源:owncloudservice.cpp

示例11: OwnCloudService

/**
 * @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);
    }
}
开发者ID:calis2002,项目名称:QOwnNotes,代码行数:24,代码来源:tododialog.cpp

示例12: removeCalendarItem

/**
 * @brief Removes a todo list item from the ownCloud server
 */
void OwnCloudService::removeCalendarItem(CalendarItem calItem,
                                         TodoDialog *dialog) {
    this->todoDialog = dialog;
    this->calendarName = calendarName;

    QUrl url(calItem.getUrl());
    QNetworkRequest r(url);
    addAuthHeader(&r);

    QNetworkReply *reply = networkManager->sendCustomRequest(r, "DELETE");
    QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)), reply,
                     SLOT(ignoreSslErrors()));
}
开发者ID:wexaadev,项目名称:QOwnNotes,代码行数:16,代码来源:owncloudservice.cpp

示例13: blocker

/**
 * Reloads the task list from the SQLite database
 */
void TodoDialog::reloadTodoListItems() {
    QList<CalendarItem> calendarItemList = CalendarItem::fetchAllByCalendar(
            ui->todoListSelector->currentText());

    int itemCount = calendarItemList.count();
    MetricsService::instance()->sendEventIfEnabled(
            "todo/list/loaded",
            "todo",
            "todo list loaded",
            QString::number(itemCount) + " todo items",
            itemCount);

    {
        const QSignalBlocker blocker(ui->todoList);
        Q_UNUSED(blocker);

        ui->todoList->clear();

        QListIterator<CalendarItem> itr(calendarItemList);
        while (itr.hasNext()) {
            CalendarItem calItem = itr.next();

            // skip completed items if the "show completed items" checkbox
            // is not checked
            if (!ui->showCompletedItemsCheckBox->checkState()) {
                if (calItem.isCompleted()) {
                    continue;
                }
            }

            QString uid = calItem.getUid();

            // skip items that were not fully loaded yet
            if (uid == "") {
                continue;
            }

            QListWidgetItem *item = new QListWidgetItem(calItem.getSummary());
            item->setData(Qt::UserRole, uid);
            item->setCheckState(
                    calItem.isCompleted() ? Qt::Checked : Qt::Unchecked);
            item->setFlags(
                    Qt::ItemIsDragEnabled |
                    Qt::ItemIsDropEnabled |
                    Qt::ItemIsEnabled |
                    Qt::ItemIsUserCheckable |
                    Qt::ItemIsSelectable);

            ui->todoList->addItem(item);
        }
    }

    // set the current row of the task list to the first row
    jumpToTodoListItem();

    // set the focus to the description edit if we wanted to
    if (_setFocusToDescriptionEdit) {
        ui->descriptionEdit->setFocus();
        _setFocusToDescriptionEdit = false;
    }
}
开发者ID:pbek,项目名称:QOwnNotes,代码行数:64,代码来源:tododialog.cpp

示例14: qDebug

void OwnCloudService::slotReplyFinished(QNetworkReply *reply) {
    qDebug() << "Reply from " << reply->url().path();
    // qDebug() << reply->errorString();

    // this should only be called from the settings dialog
    if (reply->url().path().endsWith(appInfoPath)) {
        qDebug() << "Reply from app info";

        // check if everything is all right and call the callback method
        checkAppInfo(reply);

        return;
    } else {
        QByteArray arr = reply->readAll();
        QString data = QString(arr);

        if (reply->url().path().endsWith(versionListPath)) {
            qDebug() << "Reply from version list";
            // qDebug() << data;

            // handle the versions loading
            handleVersionsLoading(data);
            return;
        } else if (reply->url().path().endsWith(trashListPath)) {
            qDebug() << "Reply from trash list";
            // qDebug() << data;

            // handle the loading of trashed notes
            handleTrashedLoading(data);
            return;
        } else if (reply->url().path().endsWith(capabilitiesPath)) {
            qDebug() << "Reply from capabilities page";

            if (data.startsWith("<?xml version=")) {
                settingsDialog->setOKLabelData(3, "ok", SettingsDialog::OK);
            } else {
                settingsDialog->setOKLabelData(3, "not correct",
                                               SettingsDialog::Failure);
            }

            return;
        } else if (reply->url().path().endsWith(ownCloudTestPath)) {
            qDebug() << "Reply from ownCloud test page";

            if (data.startsWith("<?xml version=")) {
                settingsDialog->setOKLabelData(2, "ok", SettingsDialog::OK);
            } else {
                settingsDialog->setOKLabelData(2, "not detected",
                                               SettingsDialog::Failure);
            }

            return;
        } else if (reply->url().path().endsWith(restoreTrashedNotePath)) {
            qDebug() << "Reply from ownCloud restore trashed note page";
            // qDebug() << data;

            return;
        } else if (reply->url().path().endsWith(serverUrlPath + calendarPath)) {
            qDebug() << "Reply from ownCloud calendar page";
            // qDebug() << data;

            QStringList calendarHrefList = parseCalendarHrefList(data);
            settingsDialog->refreshTodoCalendarList(calendarHrefList);

            return;
        } else if (reply->url().path()
                .startsWith(serverUrlPath + calendarPath)) {
            // check if we have a reply from a calendar item request
            if (reply->url().path().endsWith(".ics")) {
                qDebug() << "Reply from ownCloud calendar item ics page";
                // qDebug() << data;

                // a workaround for a ownCloud error message
                if (data.indexOf(
                        "<s:message>Unable to generate a URL for the named"
                                " route \"tasksplus.page.index\" as such route"
                                " does not exist.</s:message>") >
                    20) {
                    data = "";
                }

                // this will mostly happen after the PUT request to update
                // or create a todo item
                if (data == "") {
                    // reload the todo list from server
                    this->todoDialog->reloadTodoList();
                }

                // increment the progress bar
                this->todoDialog->todoItemLoadingProgressBarIncrement();

                // fetch the calendar item, that was already stored
                // by loadTodoItems()
                CalendarItem calItem = CalendarItem::fetchByUrlAndCalendar(
                        reply->url().toString(), calendarName);
                if (calItem.isFetched()) {
                    // update the item with the ics data
                    bool wasUpdated = calItem.updateWithICSData(data);

                    // if item wasn't updated (for example because it was no
//.........这里部分代码省略.........
开发者ID:hckweb,项目名称:QOwnNotes,代码行数:101,代码来源:owncloudservice.cpp

示例15: QUrl

void OwnCloudService::loadTodoItems(QString &data) {
    QDomDocument doc;
    doc.setContent(data, true);

    // fetch all urls that are currently in the calendar
    QList<QUrl> calendarItemUrlRemoveList =
            CalendarItem::fetchAllUrlsByCalendar(calendarName);

    QDomNodeList responseNodes = doc.elementsByTagNameNS(NS_DAV, "response");
    int responseNodesCount = responseNodes.length();
    int requestCount = 0;

    // set the preliminary maximum of the progress bar
    this->todoDialog->todoItemLoadingProgressBarSetMaximum(responseNodesCount);

    // loop all response blocks
    for (int i = 0; i < responseNodesCount; ++i) {
        QDomNode responseNode = responseNodes.at(i);
        if (responseNode.isElement()) {
            QDomElement elem = responseNode.toElement();

            // check if we have an url
            QDomNodeList urlPartNodes = elem.elementsByTagNameNS(NS_DAV,
                                                                 "href");
            if (urlPartNodes.length()) {
                QString urlPart = urlPartNodes.at(0).toElement().text();

                if (urlPart == "") {
                    continue;
                }

                QUrl calendarItemUrl = QUrl(serverUrlWithoutPath + urlPart);

                // check if we have an etag
                QDomNodeList etagNodes = elem.elementsByTagNameNS(NS_DAV,
                                                                  "getetag");
                if (etagNodes.length()) {
                    QString etag = etagNodes.at(0).toElement().text();
                    etag.replace("\"", "");
                    qDebug() << __func__ << " - 'etag': " << etag;

                    // check if we have a last modified date
                    QDomNodeList lastModifiedNodes = elem.elementsByTagNameNS(
                            NS_DAV, "getlastmodified");
                    if (lastModifiedNodes.length()) {
                        const QString lastModified = lastModifiedNodes.at(
                                0).toElement().text();
                        bool fetchItem = false;

                        // try to fetch the calendar item by url
                        CalendarItem calItem = CalendarItem::fetchByUrl(
                                calendarItemUrl);
                        if (calItem.isFetched()) {
                            // check if calendar item was modified
                            if (calItem.getETag() != etag) {
                                // store etag and last modified date
                                calItem.setETag(etag);
                                calItem.setLastModifiedString(lastModified);
                                calItem.store();

                                // we want to update the item from server
                                fetchItem = true;
                            }
                        } else {
                            // calendar item was not found
                            // create calendar item for fetching
                            CalendarItem::addCalendarItemForRequest(
                                    calendarName, calendarItemUrl, etag,
                                    lastModified);
                            fetchItem = true;
                        }

                        // remove the url from the list of calendar item urls
                        // to remove
                        if (calendarItemUrlRemoveList.contains(
                                calendarItemUrl)) {
                            calendarItemUrlRemoveList.removeAll(
                                    calendarItemUrl);
                        }

                        // fetch the calendar item
                        if (fetchItem) {
                            QNetworkRequest r(calendarItemUrl);
                            addAuthHeader(&r);

                            QNetworkReply *reply = networkManager->get(r);
                            ignoreSslErrorsIfAllowed(reply);

                            requestCount++;
                        }
                    }
                }
            }
        }
    }

    // set the real maximum of the progress bar
    this->todoDialog->todoItemLoadingProgressBarSetMaximum(requestCount);

    // hide progress bar if there were no updates
//.........这里部分代码省略.........
开发者ID:hckweb,项目名称:QOwnNotes,代码行数:101,代码来源:owncloudservice.cpp


注:本文中的CalendarItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。