Merge remote-tracking branch 'origin/KDE/4.7' into origin-frameworks
Conflicts: experimental/libkactivities/ plasma/applet.h plasma/theme.cpp staging/libkcoreaddons/src/jobs/kjob.cpp
This commit is contained in:
commit
c7ab521ee7
@ -58,22 +58,19 @@ AbstractToolBox::~AbstractToolBox()
|
|||||||
|
|
||||||
AbstractToolBox *AbstractToolBox::load(const QString &name, const QVariantList &args, Plasma::Containment *containment)
|
AbstractToolBox *AbstractToolBox::load(const QString &name, const QVariantList &args, Plasma::Containment *containment)
|
||||||
{
|
{
|
||||||
const QString constraint = QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
const QString constraint = name.isEmpty() ? QString() : QString("[X-KDE-PluginInfo-Name] == '%1'").arg(name);
|
||||||
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ToolBox", constraint);
|
KService::List offers = KServiceTypeTrader::self()->query("Plasma/ToolBox", constraint);
|
||||||
|
|
||||||
if (!offers.isEmpty()) {
|
if (!offers.isEmpty()) {
|
||||||
KService::Ptr offer = offers.first();
|
KService::Ptr offer = offers.first();
|
||||||
|
|
||||||
KPluginLoader plugin(*offer);
|
KPluginLoader plugin(*offer);
|
||||||
|
if (Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
|
||||||
if (!Plasma::isPluginVersionCompatible(plugin.pluginVersion())) {
|
return offer->createInstance<AbstractToolBox>(containment, args);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return offer->createInstance<AbstractToolBox>(containment, args);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
KPluginInfo::List AbstractToolBox::listToolBoxInfo(const QString
|
KPluginInfo::List AbstractToolBox::listToolBoxInfo(const QString
|
||||||
|
31
applet.cpp
31
applet.cpp
@ -1142,6 +1142,8 @@ void Applet::setGlobalShortcut(const KShortcut &shortcut)
|
|||||||
foreach (QWidget *w, widgets) {
|
foreach (QWidget *w, widgets) {
|
||||||
w->addAction(d->activationAction);
|
w->addAction(d->activationAction);
|
||||||
}
|
}
|
||||||
|
} else if (d->activationAction->globalShortcut() == shortcut) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary();
|
//kDebug() << "before" << shortcut.primary() << d->activationAction->globalShortcut().primary();
|
||||||
@ -1515,6 +1517,7 @@ void Applet::showConfigurationInterface()
|
|||||||
#ifndef PLASMA_NO_KUTILS
|
#ifndef PLASMA_NO_KUTILS
|
||||||
KCModuleProxy *module = new KCModuleProxy(kcm);
|
KCModuleProxy *module = new KCModuleProxy(kcm);
|
||||||
if (module->realModule()) {
|
if (module->realModule()) {
|
||||||
|
connect(module, SIGNAL(changed(bool)), dialog, SLOT(settingsModified(bool)));
|
||||||
dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon());
|
dialog->addPage(module, module->moduleInfo().moduleName(), module->moduleInfo().icon());
|
||||||
hasPages = true;
|
hasPages = true;
|
||||||
} else {
|
} else {
|
||||||
@ -1621,6 +1624,7 @@ KConfigDialog *AppletPrivate::generateGenericConfigDialog()
|
|||||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
q->createConfigurationInterface(dialog);
|
q->createConfigurationInterface(dialog);
|
||||||
dialog->showButton(KDialog::Default, false);
|
dialog->showButton(KDialog::Default, false);
|
||||||
|
dialog->showButton(KDialog::Help, false);
|
||||||
QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished()));
|
QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished()));
|
||||||
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
|
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()));
|
||||||
return dialog;
|
return dialog;
|
||||||
@ -1644,11 +1648,11 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
|
|||||||
|
|
||||||
if (!shortcutEditor) {
|
if (!shortcutEditor) {
|
||||||
shortcutEditor = new KKeySequenceWidget(page);
|
shortcutEditor = new KKeySequenceWidget(page);
|
||||||
QObject::connect(shortcutEditor, SIGNAL(destroyed(QObject*)), q, SLOT(clearShortcutEditorPtr()));
|
QObject::connect(shortcutEditor.data(), SIGNAL(keySequenceChanged(QKeySequence)), dialog, SLOT(settingsModified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
shortcutEditor->setKeySequence(q->globalShortcut().primary());
|
shortcutEditor.data()->setKeySequence(q->globalShortcut().primary());
|
||||||
layout->addWidget(shortcutEditor);
|
layout->addWidget(shortcutEditor.data());
|
||||||
layout->addStretch();
|
layout->addStretch();
|
||||||
dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard");
|
dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard");
|
||||||
|
|
||||||
@ -1663,7 +1667,9 @@ void AppletPrivate::addPublishPage(KConfigDialog *dialog)
|
|||||||
QWidget *page = new QWidget;
|
QWidget *page = new QWidget;
|
||||||
publishUI.setupUi(page);
|
publishUI.setupUi(page);
|
||||||
publishUI.publishCheckbox->setChecked(q->isPublished());
|
publishUI.publishCheckbox->setChecked(q->isPublished());
|
||||||
|
QObject::connect(publishUI.publishCheckbox, SIGNAL(clicked(bool)), dialog, SLOT(settingsModified()));
|
||||||
publishUI.allUsersCheckbox->setEnabled(q->isPublished());
|
publishUI.allUsersCheckbox->setEnabled(q->isPublished());
|
||||||
|
QObject::connect(publishUI.allUsersCheckbox, SIGNAL(clicked(bool)), dialog, SLOT(settingsModified()));
|
||||||
|
|
||||||
QString resourceName =
|
QString resourceName =
|
||||||
i18nc("%1 is the name of a plasmoid, %2 the name of the machine that plasmoid is published on",
|
i18nc("%1 is the name of a plasmoid, %2 the name of the machine that plasmoid is published on",
|
||||||
@ -1689,15 +1695,10 @@ void AppletPrivate::publishCheckboxStateChanged(int state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::clearShortcutEditorPtr()
|
|
||||||
{
|
|
||||||
shortcutEditor = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AppletPrivate::configDialogFinished()
|
void AppletPrivate::configDialogFinished()
|
||||||
{
|
{
|
||||||
if (shortcutEditor) {
|
if (shortcutEditor) {
|
||||||
QKeySequence sequence = shortcutEditor->keySequence();
|
QKeySequence sequence = shortcutEditor.data()->keySequence();
|
||||||
if (sequence != q->globalShortcut().primary()) {
|
if (sequence != q->globalShortcut().primary()) {
|
||||||
q->setGlobalShortcut(KShortcut(sequence));
|
q->setGlobalShortcut(KShortcut(sequence));
|
||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
@ -1771,11 +1772,6 @@ void AppletPrivate::updateShortcuts()
|
|||||||
|
|
||||||
void AppletPrivate::propagateConfigChanged()
|
void AppletPrivate::propagateConfigChanged()
|
||||||
{
|
{
|
||||||
if (script && configLoader) {
|
|
||||||
configLoader->readConfig();
|
|
||||||
script->configChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isContainment) {
|
if (isContainment) {
|
||||||
Containment *c = qobject_cast<Containment *>(q);
|
Containment *c = qobject_cast<Containment *>(q);
|
||||||
if (c) {
|
if (c) {
|
||||||
@ -1788,6 +1784,12 @@ void AppletPrivate::propagateConfigChanged()
|
|||||||
|
|
||||||
void Applet::configChanged()
|
void Applet::configChanged()
|
||||||
{
|
{
|
||||||
|
if (d->script) {
|
||||||
|
if (d->configLoader) {
|
||||||
|
d->configLoader->readConfig();
|
||||||
|
}
|
||||||
|
d->script->configChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
||||||
@ -2226,7 +2228,6 @@ AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int
|
|||||||
configLoader(0),
|
configLoader(0),
|
||||||
actions(AppletPrivate::defaultActions(applet)),
|
actions(AppletPrivate::defaultActions(applet)),
|
||||||
activationAction(0),
|
activationAction(0),
|
||||||
shortcutEditor(0),
|
|
||||||
itemStatus(UnknownStatus),
|
itemStatus(UnknownStatus),
|
||||||
preferredSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored),
|
preferredSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored),
|
||||||
modificationsTimer(0),
|
modificationsTimer(0),
|
||||||
|
2
applet.h
2
applet.h
@ -992,7 +992,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
|||||||
Q_PRIVATE_SLOT(d, void cleanUpAndDelete())
|
Q_PRIVATE_SLOT(d, void cleanUpAndDelete())
|
||||||
Q_PRIVATE_SLOT(d, void selectItemToDestroy())
|
Q_PRIVATE_SLOT(d, void selectItemToDestroy())
|
||||||
Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
|
Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
|
||||||
Q_PRIVATE_SLOT(d, void clearShortcutEditorPtr())
|
Q_PRIVATE_SLOT(d, void destroyMessageOverlay())
|
||||||
Q_PRIVATE_SLOT(d, void configDialogFinished())
|
Q_PRIVATE_SLOT(d, void configDialogFinished())
|
||||||
Q_PRIVATE_SLOT(d, void updateShortcuts())
|
Q_PRIVATE_SLOT(d, void updateShortcuts())
|
||||||
Q_PRIVATE_SLOT(d, void publishCheckboxStateChanged(int state))
|
Q_PRIVATE_SLOT(d, void publishCheckboxStateChanged(int state))
|
||||||
|
@ -155,7 +155,7 @@ void Containment::init()
|
|||||||
|
|
||||||
setCacheMode(NoCache);
|
setCacheMode(NoCache);
|
||||||
setFlag(QGraphicsItem::ItemIsMovable, false);
|
setFlag(QGraphicsItem::ItemIsMovable, false);
|
||||||
setFlag(QGraphicsItem::ItemClipsChildrenToShape, false);
|
setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setAcceptsHoverEvents(true);
|
setAcceptsHoverEvents(true);
|
||||||
|
|
||||||
|
12
dialog.cpp
12
dialog.cpp
@ -517,12 +517,6 @@ void Dialog::keyPressEvent(QKeyEvent *event)
|
|||||||
|
|
||||||
bool Dialog::event(QEvent *event)
|
bool Dialog::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::Paint) {
|
|
||||||
QPainter p(this);
|
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
|
||||||
p.fillRect(rect(), Qt::transparent);
|
|
||||||
}
|
|
||||||
|
|
||||||
return QWidget::event(event);
|
return QWidget::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,7 +732,7 @@ void Dialog::animatedHide(Plasma::Direction direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!KWindowSystem::compositingActive()) {
|
if (!Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -767,7 +761,7 @@ void Dialog::animatedHide(Plasma::Direction direction)
|
|||||||
|
|
||||||
void Dialog::animatedShow(Plasma::Direction direction)
|
void Dialog::animatedShow(Plasma::Direction direction)
|
||||||
{
|
{
|
||||||
if (!KWindowSystem::compositingActive()) {
|
if (!Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
|
||||||
show();
|
show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -791,7 +785,7 @@ void Dialog::animatedShow(Plasma::Direction direction)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KWindowSystem::compositingActive()) {
|
if (Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
|
||||||
Plasma::WindowEffects::slideWindow(this, location);
|
Plasma::WindowEffects::slideWindow(this, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,6 @@ public:
|
|||||||
void cleanUpAndDelete();
|
void cleanUpAndDelete();
|
||||||
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
||||||
void addPublishPage(KConfigDialog *dialog);
|
void addPublishPage(KConfigDialog *dialog);
|
||||||
void clearShortcutEditorPtr();
|
|
||||||
void configDialogFinished();
|
void configDialogFinished();
|
||||||
KConfigDialog *generateGenericConfigDialog();
|
KConfigDialog *generateGenericConfigDialog();
|
||||||
void addStandardConfigurationPages(KConfigDialog *dialog);
|
void addStandardConfigurationPages(KConfigDialog *dialog);
|
||||||
@ -166,7 +165,7 @@ public:
|
|||||||
KAction *activationAction;
|
KAction *activationAction;
|
||||||
|
|
||||||
// configuration
|
// configuration
|
||||||
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
QWeakPointer<KKeySequenceWidget> shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
||||||
|
|
||||||
ItemStatus itemStatus;
|
ItemStatus itemStatus;
|
||||||
KUrl remoteLocation;
|
KUrl remoteLocation;
|
||||||
|
@ -58,7 +58,7 @@ bool EffectWatcher::x11Event(XEvent *event)
|
|||||||
bool nowEffectActive = isEffectActive();
|
bool nowEffectActive = isEffectActive();
|
||||||
if (m_effectActive != nowEffectActive) {
|
if (m_effectActive != nowEffectActive) {
|
||||||
m_effectActive = nowEffectActive;
|
m_effectActive = nowEffectActive;
|
||||||
emit blurBehindChanged(m_effectActive);
|
emit effectChanged(m_effectActive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void blurBehindChanged(bool blur);
|
void effectChanged(bool on);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_property;
|
QString m_property;
|
||||||
|
@ -360,10 +360,9 @@ void ToolTip::resizeEvent(QResizeEvent *e)
|
|||||||
void ToolTip::paintEvent(QPaintEvent *e)
|
void ToolTip::paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
|
||||||
painter.setClipRect(e->rect());
|
painter.setClipRect(e->rect());
|
||||||
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
painter.fillRect(rect(), Qt::transparent);
|
painter.fillRect(e->rect(), Qt::transparent);
|
||||||
|
|
||||||
d->background->paintFrame(&painter);
|
d->background->paintFrame(&painter);
|
||||||
}
|
}
|
||||||
|
84
theme.cpp
84
theme.cpp
@ -84,8 +84,9 @@ public:
|
|||||||
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
|
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
|
||||||
defaultWallpaperHeight(DEFAULT_WALLPAPER_HEIGHT),
|
defaultWallpaperHeight(DEFAULT_WALLPAPER_HEIGHT),
|
||||||
pixmapCache(0),
|
pixmapCache(0),
|
||||||
|
cachesToDiscard(NoCache),
|
||||||
locolor(false),
|
locolor(false),
|
||||||
compositingActive(KWindowSystem::compositingActive()),
|
compositingActive(KWindowSystem::self()->compositingActive()),
|
||||||
blurActive(false),
|
blurActive(false),
|
||||||
isDefault(false),
|
isDefault(false),
|
||||||
useGlobal(true),
|
useGlobal(true),
|
||||||
@ -96,27 +97,32 @@ public:
|
|||||||
ThemeConfig config;
|
ThemeConfig config;
|
||||||
cacheTheme = config.cacheTheme();
|
cacheTheme = config.cacheTheme();
|
||||||
|
|
||||||
|
saveTimer = new QTimer(q);
|
||||||
|
saveTimer->setSingleShot(true);
|
||||||
|
saveTimer->setInterval(600);
|
||||||
|
QObject::connect(saveTimer, SIGNAL(timeout()), q, SLOT(scheduledCacheUpdate()));
|
||||||
|
|
||||||
|
updateNotificationTimer = new QTimer(q);
|
||||||
|
updateNotificationTimer->setSingleShot(true);
|
||||||
|
updateNotificationTimer->setInterval(500);
|
||||||
|
QObject::connect(updateNotificationTimer, SIGNAL(timeout()), q, SLOT(notifyOfChanged()));
|
||||||
|
|
||||||
if (QPixmap::defaultDepth() > 8) {
|
if (QPixmap::defaultDepth() > 8) {
|
||||||
QObject::connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), q, SLOT(compositingChanged(bool)));
|
QObject::connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), q, SLOT(compositingChanged(bool)));
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
//watch for blur effect property changes as well
|
//watch for blur effect property changes as well
|
||||||
effectWatcher = 0;
|
if (!s_blurEffectWatcher) {
|
||||||
effectWatcher = new EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION");
|
s_blurEffectWatcher = new EffectWatcher("_KDE_NET_WM_BLUR_BEHIND_REGION");
|
||||||
QObject::connect(effectWatcher, SIGNAL(blurBehindChanged(bool)), q, SLOT(blurBehindChanged(bool)));
|
}
|
||||||
|
|
||||||
|
QObject::connect(s_blurEffectWatcher, SIGNAL(effectChanged(bool)), q, SLOT(blurBehindChanged(bool)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
saveTimer = new QTimer(q);
|
|
||||||
saveTimer->setSingleShot(true);
|
|
||||||
QObject::connect(saveTimer, SIGNAL(timeout()), q, SLOT(scheduledCacheUpdate()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~ThemePrivate()
|
~ThemePrivate()
|
||||||
{
|
{
|
||||||
delete pixmapCache;
|
delete pixmapCache;
|
||||||
#ifdef Q_WS_X11
|
|
||||||
delete effectWatcher;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KConfigGroup &config()
|
KConfigGroup &config()
|
||||||
@ -145,6 +151,8 @@ public:
|
|||||||
void compositingChanged(bool active);
|
void compositingChanged(bool active);
|
||||||
void discardCache(CacheTypes caches);
|
void discardCache(CacheTypes caches);
|
||||||
void scheduledCacheUpdate();
|
void scheduledCacheUpdate();
|
||||||
|
void scheduleThemeChangeNotification(CacheTypes caches);
|
||||||
|
void notifyOfChanged();
|
||||||
void colorsChanged();
|
void colorsChanged();
|
||||||
void blurBehindChanged(bool blur);
|
void blurBehindChanged(bool blur);
|
||||||
bool useCache();
|
bool useCache();
|
||||||
@ -158,6 +166,7 @@ public:
|
|||||||
static const char *defaultTheme;
|
static const char *defaultTheme;
|
||||||
static const char *systemColorsTheme;
|
static const char *systemColorsTheme;
|
||||||
static const char *themeRcFile;
|
static const char *themeRcFile;
|
||||||
|
static EffectWatcher *s_blurEffectWatcher;
|
||||||
|
|
||||||
Theme *q;
|
Theme *q;
|
||||||
QString themeName;
|
QString themeName;
|
||||||
@ -181,10 +190,10 @@ public:
|
|||||||
QHash<styles, QString> cachedStyleSheets;
|
QHash<styles, QString> cachedStyleSheets;
|
||||||
QHash<QString, QString> discoveries;
|
QHash<QString, QString> discoveries;
|
||||||
QTimer *saveTimer;
|
QTimer *saveTimer;
|
||||||
|
QTimer *updateNotificationTimer;
|
||||||
|
int toolTipDelay;
|
||||||
|
CacheTypes cachesToDiscard;
|
||||||
|
|
||||||
#ifdef Q_WS_X11
|
|
||||||
EffectWatcher *effectWatcher;
|
|
||||||
#endif
|
|
||||||
bool locolor : 1;
|
bool locolor : 1;
|
||||||
bool compositingActive : 1;
|
bool compositingActive : 1;
|
||||||
bool blurActive : 1;
|
bool blurActive : 1;
|
||||||
@ -200,6 +209,7 @@ const char *ThemePrivate::themeRcFile = "plasmarc";
|
|||||||
// the system colors theme is used to cache unthemed svgs with colorization needs
|
// the system colors theme is used to cache unthemed svgs with colorization needs
|
||||||
// these svgs do not follow the theme's colors, but rather the system colors
|
// these svgs do not follow the theme's colors, but rather the system colors
|
||||||
const char *ThemePrivate::systemColorsTheme = "internal-system-colors";
|
const char *ThemePrivate::systemColorsTheme = "internal-system-colors";
|
||||||
|
EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0;
|
||||||
|
|
||||||
bool ThemePrivate::useCache()
|
bool ThemePrivate::useCache()
|
||||||
{
|
{
|
||||||
@ -267,8 +277,8 @@ void ThemePrivate::compositingChanged(bool active)
|
|||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
if (compositingActive != active) {
|
if (compositingActive != active) {
|
||||||
compositingActive = active;
|
compositingActive = active;
|
||||||
discardCache(PixmapCache | SvgElementsCache);
|
//kDebug() << QTime::currentTime();
|
||||||
emit q->themeChanged();
|
scheduleThemeChangeNotification(PixmapCache | SvgElementsCache);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -321,17 +331,31 @@ void ThemePrivate::scheduledCacheUpdate()
|
|||||||
|
|
||||||
void ThemePrivate::colorsChanged()
|
void ThemePrivate::colorsChanged()
|
||||||
{
|
{
|
||||||
discardCache(PixmapCache);
|
|
||||||
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
|
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
|
||||||
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
|
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
|
||||||
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
|
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
|
||||||
emit q->themeChanged();
|
scheduleThemeChangeNotification(PixmapCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemePrivate::blurBehindChanged(bool blur)
|
void ThemePrivate::blurBehindChanged(bool blur)
|
||||||
{
|
{
|
||||||
blurActive = blur;
|
if (blurActive != blur) {
|
||||||
discardCache(PixmapCache | SvgElementsCache);
|
blurActive = blur;
|
||||||
|
scheduleThemeChangeNotification(PixmapCache | SvgElementsCache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThemePrivate::scheduleThemeChangeNotification(CacheTypes caches)
|
||||||
|
{
|
||||||
|
cachesToDiscard |= caches;
|
||||||
|
updateNotificationTimer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThemePrivate::notifyOfChanged()
|
||||||
|
{
|
||||||
|
//kDebug() << cachesToDiscard;
|
||||||
|
discardCache(cachesToDiscard);
|
||||||
|
cachesToDiscard = NoCache;
|
||||||
emit q->themeChanged();
|
emit q->themeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +520,10 @@ void ThemePrivate::settingsFileChanged(const QString &file)
|
|||||||
|
|
||||||
void Theme::settingsChanged()
|
void Theme::settingsChanged()
|
||||||
{
|
{
|
||||||
d->setThemeName(d->config().readEntry("name", ThemePrivate::defaultTheme), false);
|
KConfigGroup cg = d->config();
|
||||||
|
d->setThemeName(cg.readEntry("name", ThemePrivate::defaultTheme), false);
|
||||||
|
cg = KConfigGroup(cg.config(), "PlasmaToolTips");
|
||||||
|
d->toolTipDelay = cg.readEntry("Delay", qreal(0.7));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Theme::setThemeName(const QString &themeName)
|
void Theme::setThemeName(const QString &themeName)
|
||||||
@ -631,9 +658,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
|||||||
cg.sync();
|
cg.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
discardCache(SvgElementsCache);
|
scheduleThemeChangeNotification(SvgElementsCache);
|
||||||
|
|
||||||
emit q->themeChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Theme::themeName() const
|
QString Theme::themeName() const
|
||||||
@ -646,9 +671,7 @@ QString Theme::imagePath(const QString &name) const
|
|||||||
// look for a compressed svg file in the theme
|
// look for a compressed svg file in the theme
|
||||||
if (name.contains("../") || name.isEmpty()) {
|
if (name.contains("../") || name.isEmpty()) {
|
||||||
// we don't support relative paths
|
// we don't support relative paths
|
||||||
#ifndef NDEBUG
|
//kDebug() << "Theme says: bad image path " << name;
|
||||||
kDebug() << "Theme says: bad image path " << name;
|
|
||||||
#endif
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -908,7 +931,7 @@ void Theme::insertIntoCache(const QString& key, const QPixmap& pix, const QStrin
|
|||||||
|
|
||||||
d->keysToCache.insert(key, id);
|
d->keysToCache.insert(key, id);
|
||||||
d->idsToCache.insert(id, key);
|
d->idsToCache.insert(id, key);
|
||||||
d->saveTimer->start(600);
|
d->saveTimer->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,6 +1055,11 @@ KUrl Theme::homepage() const
|
|||||||
return brandConfig.readEntry("homepage", KUrl("http://www.kde.org"));
|
return brandConfig.readEntry("homepage", KUrl("http://www.kde.org"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Theme::toolTipDelay() const
|
||||||
|
{
|
||||||
|
return d->toolTipDelay;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <theme.moc>
|
#include <theme.moc>
|
||||||
|
6
theme.h
6
theme.h
@ -354,6 +354,11 @@ class PLASMA_EXPORT Theme : public QObject
|
|||||||
*/
|
*/
|
||||||
KUrl homepage() const;
|
KUrl homepage() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the default tool tip delay; -1 means "no tooltips"
|
||||||
|
*/
|
||||||
|
int toolTipDelay() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emitted when the user changes the theme. SVGs should be reloaded at
|
* Emitted when the user changes the theme. SVGs should be reloaded at
|
||||||
@ -379,6 +384,7 @@ class PLASMA_EXPORT Theme : public QObject
|
|||||||
Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))
|
Q_PRIVATE_SLOT(d, void settingsFileChanged(const QString &))
|
||||||
Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
|
Q_PRIVATE_SLOT(d, void scheduledCacheUpdate())
|
||||||
Q_PRIVATE_SLOT(d, void onAppExitCleanup())
|
Q_PRIVATE_SLOT(d, void onAppExitCleanup())
|
||||||
|
Q_PRIVATE_SLOT(d, void notifyOfChanged())
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
@ -139,21 +139,18 @@ void ToolTipManager::show(QGraphicsWidget *widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal delay = 0.0;
|
d->delayedHide = false;
|
||||||
ToolTipContent content = d->tooltips[widget];
|
d->hideTimer->stop();
|
||||||
|
d->showTimer->stop();
|
||||||
|
const int defaultDelay = Theme::defaultTheme()->toolTipDelay();
|
||||||
|
|
||||||
if (!content.isInstantPopup()) {
|
if (defaultDelay < 0) {
|
||||||
KConfig config("plasmarc");
|
return;
|
||||||
KConfigGroup cg(&config, "PlasmaToolTips");
|
|
||||||
delay = cg.readEntry("Delay", qreal(0.7));
|
|
||||||
if (delay < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
d->hideTimer->stop();
|
ToolTipContent content = d->tooltips[widget];
|
||||||
d->delayedHide = false;
|
qreal delay = content.isInstantPopup() ? 0.0 : defaultDelay;
|
||||||
d->showTimer->stop();
|
|
||||||
d->currentWidget = widget;
|
d->currentWidget = widget;
|
||||||
|
|
||||||
if (d->isShown) {
|
if (d->isShown) {
|
||||||
@ -213,6 +210,13 @@ void ToolTipManager::unregisterWidget(QGraphicsWidget *widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget == d->currentWidget) {
|
||||||
|
d->currentWidget = 0;
|
||||||
|
d->showTimer->stop(); // stop the timer to show the tooltip
|
||||||
|
d->delayedHide = false;
|
||||||
|
d->hideTipWidget();
|
||||||
|
}
|
||||||
|
|
||||||
widget->removeEventFilter(this);
|
widget->removeEventFilter(this);
|
||||||
d->removeWidget(widget);
|
d->removeWidget(widget);
|
||||||
}
|
}
|
||||||
@ -345,14 +349,13 @@ void ToolTipManagerPrivate::clearTips()
|
|||||||
|
|
||||||
void ToolTipManagerPrivate::resetShownState()
|
void ToolTipManagerPrivate::resetShownState()
|
||||||
{
|
{
|
||||||
if (currentWidget) {
|
if (!tipWidget || !tipWidget->isVisible() || delayedHide) {
|
||||||
if (!tipWidget || !tipWidget->isVisible() || delayedHide) {
|
//One might have moused out and back in again
|
||||||
//One might have moused out and back in again
|
showTimer->stop();
|
||||||
delayedHide = false;
|
delayedHide = false;
|
||||||
isShown = false;
|
isShown = false;
|
||||||
currentWidget = 0;
|
currentWidget = 0;
|
||||||
hideTipWidget();
|
hideTipWidget();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user