aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/theme
diff options
context:
space:
mode:
authorGravatar Elvio Basello2012-04-16 02:08:17 +0000
committerGravatar Elvio Basello2012-04-16 02:08:17 +0000
commita0e7ab07c793ef6b32b8a55215939b2431c5cff3 (patch)
treebf5cb7eed25f126ec950fff20fd5b5253e427672 /src/modules/theme
parentfixed bug related to theme deletion, if they are builtin we can't delete them (diff)
downloadKVIrc-a0e7ab07c793ef6b32b8a55215939b2431c5cff3.tar.gz
KVIrc-a0e7ab07c793ef6b32b8a55215939b2431c5cff3.tar.bz2
KVIrc-a0e7ab07c793ef6b32b8a55215939b2431c5cff3.zip
extended last fix to multi-selection
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@6153 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/theme')
-rw-r--r--src/modules/theme/ThemeManagementDialog.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/modules/theme/ThemeManagementDialog.cpp b/src/modules/theme/ThemeManagementDialog.cpp
index 0cba8314e..9710750e5 100644
--- a/src/modules/theme/ThemeManagementDialog.cpp
+++ b/src/modules/theme/ThemeManagementDialog.cpp
@@ -382,11 +382,18 @@ void ThemeManagementDialog::deleteTheme()
QList<QListWidgetItem *> itemsSelected = m_pListWidget->selectedItems();
for(int i=0; i < itemsSelected.count(); i++)
{
+ ThemeListWidgetItem * pItem = dynamic_cast<ThemeListWidgetItem *>(itemsSelected.at(i));
+ if(!pItem)
+ return;
+ KviThemeInfo * pInfo = pItem->themeInfo();
+ if(pInfo->isBuiltin())
+ continue;
+
if(!KviMessageBox::yesNo(
__tr2qs_ctx("Delete Theme - KVIrc","theme"),
__tr2qs_ctx("Do you really wish to delete theme \"%Q\" (version %Q)?","theme"),
- &(((ThemeListWidgetItem *)itemsSelected.at(i))->themeInfo()->name()),&(((ThemeListWidgetItem *)itemsSelected.at(i))->themeInfo()->version())
- ))
+ pInfo->name().toUtf8().data(),pInfo->version().toUtf8().data())
+ )
goto jump_out;
QString szThemePath;
@@ -480,18 +487,23 @@ void ThemeManagementDialog::fillThemeBox()
void ThemeManagementDialog::enableDisableButtons()
{
QList<QListWidgetItem *> itemsSelected = m_pListWidget->selectedItems();
- bool bHasItems = itemsSelected.count() ? true : false;
+ int iCount = itemsSelected.count();
+ bool bHasItems = iCount ? true : false;
m_pPackThemeButton->setEnabled(bHasItems);
-
- ThemeListWidgetItem * pItem = dynamic_cast<ThemeListWidgetItem *>(m_pListWidget->currentItem());
- if(!pItem)
- return;
- KviThemeInfo * pInfo = pItem->themeInfo();
- if(pInfo->isBuiltin())
- m_pDeleteThemeButton->setEnabled(false);
- else
- m_pDeleteThemeButton->setEnabled(bHasItems);
+
+ unsigned int u = 0;
+ for(int i = 0; i < iCount; i++)
+ {
+ ThemeListWidgetItem * pItem = dynamic_cast<ThemeListWidgetItem *>(itemsSelected.at(i));
+ if(!pItem)
+ return;
+ KviThemeInfo * pInfo = pItem->themeInfo();
+ if(!pInfo->isBuiltin())
+ u++;
+ }
+
+ m_pDeleteThemeButton->setEnabled(u >= 1);
}
void ThemeManagementDialog::closeEvent(QCloseEvent * e)