[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kjots
From: Stephen Kelly <steveire () gmail ! com>
Date: 2010-06-16 13:44:07
Message-ID: 20100616134407.E275DAC8D4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1138686 by skelly:
Ask for confirmation before deleting entries. Don't delete locked entries.
The strings already exist in the application l10n template.
M +31 -4 kjotswidget.cpp
--- trunk/KDE/kdepim/kjots/kjotswidget.cpp #1138685:1138686
@@ -688,15 +688,29 @@
if ( selectedRows.size() != 1 )
return;
- Item item = selectedRows.at( 0 ).data( EntityTreeModel::ItemRole ).value<Item>();
+ const QModelIndex idx = selectedRows.at( 0 );
+ Item item = idx.data( EntityTreeModel::ItemRole ).value<Item>();
if ( !item.isValid() )
return;
- (void) new Akonadi::ItemDeleteJob( item, this );
+ if( item.hasAttribute<KJotsLockAttribute>() ) {
+ KMessageBox::information(topLevelWidget(),
+ i18n("This page is locked. You can only delete it when you first unlock \
it."), + i18n("Item is locked"));
+ return;
}
+ if ( KMessageBox::warningContinueCancel(topLevelWidget(),
+ i18nc("remove the page, by title", "<qt>Are you sure you want to delete \
the page <strong>%1</strong>?</qt>", idx.data().toString()), + \
i18n("Delete"), KStandardGuiItem::del(), KStandardGuiItem::cancel(), \
"DeletePageWarning") == KMessageBox::Cancel) { + return;
+ }
+
+ (void) new Akonadi::ItemDeleteJob( item, this );
+}
+
void KJotsWidget::deleteBook()
{
QModelIndexList selectedRows = treeview->selectionModel()->selectedRows();
@@ -704,7 +718,8 @@
if ( selectedRows.size() != 1 )
return;
- Collection col = selectedRows.at( 0 ).data( EntityTreeModel::CollectionRole \
).value<Collection>(); + const QModelIndex idx = selectedRows.at( 0 );
+ Collection col = idx.data( EntityTreeModel::CollectionRole ).value<Collection>();
if ( !col.isValid() )
return;
@@ -712,10 +727,22 @@
if (col.parentCollection() == Collection::root())
return;
- (void) new Akonadi::CollectionDeleteJob( col, this );
+ if( col.hasAttribute<KJotsLockAttribute>() ) {
+ KMessageBox::information(topLevelWidget(),
+ i18n("This book is locked. You can only delete it when you first unlock \
it."), + i18n("Item is locked"));
+ return;
}
+ if ( KMessageBox::warningContinueCancel(topLevelWidget(),
+ i18nc("remove the book, by title", "<qt>Are you sure you want to delete the \
book <strong>%1</strong>?</qt>", idx.data().toString()), + i18n("Delete"), \
KStandardGuiItem::del(), KStandardGuiItem::cancel(), "DeleteBookWarning") == \
KMessageBox::Cancel) { + return;
+ }
+ (void) new Akonadi::CollectionDeleteJob( col, this );
+}
+
void KJotsWidget::newBook()
{
QModelIndexList selectedRows = treeview->selectionModel()->selectedRows();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic