示例#1
0
//***********************************************
//* Restore all notes from the trash
//***********************************************
void NTrashTree::restoreAll() {
    NoteTable ntable;
    QList<qint32> lids;
    ntable.getAllDeleted(lids);
    for (int i=0; i<lids.size(); i++) {
        ntable.restoreNote(lids[i], true);
        delete global.cache[lids[i]];
        global.cache.remove(lids[i]);
    }

    emit(updateSelectionRequested());
}
示例#2
0
//***********************************************
//* Permanently delete all notes
//***********************************************
void NTrashTree::expungeAll() {
    QMessageBox msgBox;
    msgBox.setWindowTitle(tr("Verify Delete"));
    msgBox.setText(tr("Are you sure you want to permanently delete these notes?"));
    msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
    msgBox.setIcon(QMessageBox::Question);
    msgBox.setDefaultButton(QMessageBox::Yes);
    int rc = msgBox.exec();
    if (rc != QMessageBox::Yes)
        return;

    NoteTable ntable;
    QList<qint32> lids;
    ntable.getAllDeleted(lids);
    for (int i=0; i<lids.size(); i++) {
        ntable.expunge(lids[i]);
        delete global.cache[lids[i]];
        global.cache.remove(lids[i]);
    }
    emit(updateSelectionRequested());
}