From 7d2f153ae60cdaf52f4b2ac1fc8ff7732791c07e Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Fri, 9 Sep 2011 01:04:16 +0800 Subject: [PATCH] Warn users they may need to restart konsole to see transparent background. If desktop effect is enabled only after konsole has started, then users need to restart konsole to see transparent background. FEATURE: 169305 FIXED-IN: 4.8 --- src/EditProfileDialog.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 2b0cdd075..d1edc005c 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -55,6 +55,10 @@ #include "ShellCommand.h" #include "TabTitleFormatAction.h" +// FIXME: it feels bad to include a big header file just +// in order to use one of its static members. +#include "TerminalDisplay.h" + using namespace Konsole; EditProfileDialog::EditProfileDialog(QWidget* parent) @@ -458,9 +462,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info) SLOT(colorSchemeAnimationUpdate()) ); _ui->transparencyWarningWidget->setVisible(false); - _ui->transparencyWarningWidget->setText(i18n("This color scheme uses a transparent background" - " which does not appear to be supported on your" - " desktop")); + _ui->editColorSchemeButton->setEnabled(false); _ui->removeColorSchemeButton->setEnabled(false); @@ -821,8 +823,26 @@ void EditProfileDialog::updateTransparencyWarning() // zero or one indexes can be selected foreach( const QModelIndex& index , _ui->colorSchemeList->selectionModel()->selectedIndexes() ) { - bool hasTransparency = index.data(Qt::UserRole+1).value()->opacity() < 1.0; - _ui->transparencyWarningWidget->setHidden(KWindowSystem::compositingActive() || !hasTransparency); + bool needTransparency = index.data(Qt::UserRole+1).value()->opacity() < 1.0; + + if ( ! needTransparency ) + { + _ui->transparencyWarningWidget->setHidden(true); + } + else if ( ! KWindowSystem::compositingActive() ) + { + _ui->transparencyWarningWidget->setText(i18n("This color scheme uses a transparent background" + " which does not appear to be supported on your" + " desktop")); + _ui->transparencyWarningWidget->setHidden(false); + } + else if ( ! TerminalDisplay::HAVE_TRANSPARENCY ) + { + _ui->transparencyWarningWidget->setText(i18n("Konsole was started before desktop effect is enabled. " + " You need to restart konsole to see transparent background.")); + _ui->transparencyWarningWidget->setHidden(false); + } + } }