Merge remote-tracking branch 'origin/KDE/4.7'
Conflicts: experimental/libkactivities
This commit is contained in:
commit
3f743186cf
@ -151,6 +151,7 @@ set(plasma_LIB_SRCS
|
|||||||
private/storage.cpp
|
private/storage.cpp
|
||||||
private/storagethread.cpp
|
private/storagethread.cpp
|
||||||
private/style.cpp
|
private/style.cpp
|
||||||
|
private/themedwidgetinterface.cpp
|
||||||
private/trustedonlyauthorization.cpp
|
private/trustedonlyauthorization.cpp
|
||||||
private/tooltip.cpp
|
private/tooltip.cpp
|
||||||
private/wallpaperrenderthread.cpp
|
private/wallpaperrenderthread.cpp
|
||||||
@ -461,8 +462,6 @@ install(FILES
|
|||||||
|
|
||||||
install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
install(FILES data/knewstuff/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
|
|
||||||
install(FILES data/kconfig_updates/plasma_popupapplet_fix_groups.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
|
|
||||||
install(PROGRAMS data/kconfig_updates/plasma_popupapplet_fix_groups.pl DESTINATION ${KCONF_UPDATE_INSTALL_DIR})
|
|
||||||
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
||||||
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
||||||
install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
||||||
|
@ -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 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return offer->createInstance<AbstractToolBox>(containment, args);
|
return offer->createInstance<AbstractToolBox>(containment, args);
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
KPluginInfo::List AbstractToolBox::listToolBoxInfo(const QString
|
KPluginInfo::List AbstractToolBox::listToolBoxInfo(const QString
|
||||||
|
40
applet.cpp
40
applet.cpp
@ -1567,6 +1567,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();
|
||||||
@ -1900,6 +1902,11 @@ void Applet::showConfigurationInterface()
|
|||||||
KConfigSkeleton *configLoader = d->configLoader ? d->configLoader : new KConfigSkeleton(0);
|
KConfigSkeleton *configLoader = d->configLoader ? d->configLoader : new KConfigSkeleton(0);
|
||||||
dialog = new AppletConfigDialog(0, d->configDialogId(), configLoader);
|
dialog = new AppletConfigDialog(0, d->configDialogId(), configLoader);
|
||||||
|
|
||||||
|
if (!d->configLoader) {
|
||||||
|
// delete the temporary when this dialog is done
|
||||||
|
configLoader->setParent(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
dialog->setWindowTitle(d->configWindowTitle());
|
dialog->setWindowTitle(d->configWindowTitle());
|
||||||
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
bool hasPages = false;
|
bool hasPages = false;
|
||||||
@ -1916,6 +1923,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 {
|
||||||
@ -2016,14 +2024,15 @@ KConfigDialog *AppletPrivate::generateGenericConfigDialog()
|
|||||||
{
|
{
|
||||||
KConfigSkeleton *nullManager = new KConfigSkeleton(0);
|
KConfigSkeleton *nullManager = new KConfigSkeleton(0);
|
||||||
KConfigDialog *dialog = new AppletConfigDialog(0, configDialogId(), nullManager);
|
KConfigDialog *dialog = new AppletConfigDialog(0, configDialogId(), nullManager);
|
||||||
|
nullManager->setParent(dialog);
|
||||||
dialog->setFaceType(KPageDialog::Auto);
|
dialog->setFaceType(KPageDialog::Auto);
|
||||||
dialog->setWindowTitle(configWindowTitle());
|
dialog->setWindowTitle(configWindowTitle());
|
||||||
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()));
|
||||||
QObject::connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2045,11 +2054,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");
|
||||||
|
|
||||||
@ -2064,7 +2073,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",
|
||||||
@ -2090,15 +2101,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();
|
||||||
@ -2172,11 +2178,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) {
|
||||||
@ -2189,6 +2190,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)
|
||||||
@ -2515,7 +2522,7 @@ QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
|
|||||||
}
|
}
|
||||||
} else if (d->aspectRatioMode == Plasma::ConstrainedSquare) {
|
} else if (d->aspectRatioMode == Plasma::ConstrainedSquare) {
|
||||||
//enforce a size not wider than tall
|
//enforce a size not wider than tall
|
||||||
if (ff == Horizontal && (which == Qt::MaximumSize || size().height() <= KIconLoader::SizeLarge)) {
|
if (ff == Horizontal) {
|
||||||
hint.setWidth(size().height());
|
hint.setWidth(size().height());
|
||||||
//enforce a size not taller than wide
|
//enforce a size not taller than wide
|
||||||
} else if (ff == Vertical && (which == Qt::MaximumSize || size().width() <= KIconLoader::SizeLarge)) {
|
} else if (ff == Vertical && (which == Qt::MaximumSize || size().width() <= KIconLoader::SizeLarge)) {
|
||||||
@ -2657,7 +2664,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),
|
||||||
|
1
applet.h
1
applet.h
@ -1118,7 +1118,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
|||||||
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 destroyMessageOverlay())
|
Q_PRIVATE_SLOT(d, void destroyMessageOverlay())
|
||||||
Q_PRIVATE_SLOT(d, void clearShortcutEditorPtr())
|
|
||||||
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))
|
||||||
|
@ -160,7 +160,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);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ void Corona::saveLayout(const QString &configName) const
|
|||||||
if (configName.isEmpty() || configName == d->configName) {
|
if (configName.isEmpty() || configName == d->configName) {
|
||||||
c = config();
|
c = config();
|
||||||
} else {
|
} else {
|
||||||
c = KSharedConfig::openConfig(configName);
|
c = KSharedConfig::openConfig(configName, KConfig::SimpleConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->saveLayout(c);
|
d->saveLayout(c);
|
||||||
@ -337,7 +337,7 @@ void Corona::clearContainments()
|
|||||||
KSharedConfigPtr Corona::config() const
|
KSharedConfigPtr Corona::config() const
|
||||||
{
|
{
|
||||||
if (!d->config) {
|
if (!d->config) {
|
||||||
d->config = KSharedConfig::openConfig(d->configName);
|
d->config = KSharedConfig::openConfig(d->configName, KConfig::SimpleConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
return d->config;
|
return d->config;
|
||||||
@ -482,7 +482,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kDebug() << actualItem;
|
//kDebug() << actualItem;
|
||||||
|
|
||||||
if (actualItem) {
|
if (actualItem) {
|
||||||
v = viewFor(actualItem);
|
v = viewFor(actualItem);
|
||||||
@ -618,6 +618,7 @@ QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::Alig
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos.rx() = qMax(0, pos.x());
|
pos.rx() = qMax(0, pos.x());
|
||||||
|
pos.ry() = qMax(0, pos.y());
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
while(<>) {
|
|
||||||
if ($_ =~ m/^\[.*\[Configuration\]\[PopupApplet\]$/) {
|
|
||||||
print "# DELETEGROUP $_";
|
|
||||||
$_ =~ s/\[Configuration\]\[PopupApplet\]$/[PopupApplet]/;
|
|
||||||
}
|
|
||||||
print $_;
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
# Fix groups of the form ...[Configuration][PopupApplet] into ...[PopupApplet]
|
|
||||||
Id=PlasmaPopupAppletFixGroups1
|
|
||||||
File=plasma-appletsrc
|
|
||||||
Script=plasma_popupapplet_fix_groups.pl,perl
|
|
||||||
#
|
|
||||||
Id=PlasmaPopupAppletFixGroups2
|
|
||||||
File=plasmarc
|
|
||||||
Script=plasma_popupapplet_fix_groups.pl,perl
|
|
||||||
#
|
|
||||||
Id=PlasmaPopupAppletFixGroups3
|
|
||||||
File=plasmoidviewer-appletsrc
|
|
||||||
Script=plasma_popupapplet_fix_groups.pl,perl
|
|
@ -39,6 +39,7 @@ Description[pt]=Um protocolo para os serviços do Plasma
|
|||||||
Description[pt_BR]=Protocolo para os serviços do Plasma
|
Description[pt_BR]=Protocolo para os serviços do Plasma
|
||||||
Description[ro]=Un protocol pentru servicii Plasma
|
Description[ro]=Un protocol pentru servicii Plasma
|
||||||
Description[ru]=Протокол для служб Plasma
|
Description[ru]=Протокол для служб Plasma
|
||||||
|
Description[se]=Protokolla Plasma-bálvalusaid várás
|
||||||
Description[sk]=Protokol pre Plasma služby
|
Description[sk]=Protokol pre Plasma služby
|
||||||
Description[sr]=Протокол за плазма сервисе
|
Description[sr]=Протокол за плазма сервисе
|
||||||
Description[sr@ijekavian]=Протокол за плазма сервисе
|
Description[sr@ijekavian]=Протокол за плазма сервисе
|
||||||
|
@ -38,6 +38,7 @@ Comment[pt]=Serviço do Plasma
|
|||||||
Comment[pt_BR]=Serviço do Plasma
|
Comment[pt_BR]=Serviço do Plasma
|
||||||
Comment[ro]=Servicu Plasma
|
Comment[ro]=Servicu Plasma
|
||||||
Comment[ru]=Служба Plasma
|
Comment[ru]=Служба Plasma
|
||||||
|
Comment[se]=Plasma-bálvalus
|
||||||
Comment[si]=ප්ලස්මා සේවා
|
Comment[si]=ප්ලස්මා සේවා
|
||||||
Comment[sk]=Služba Plasma
|
Comment[sk]=Služba Plasma
|
||||||
Comment[sr]=Плазма сервис
|
Comment[sr]=Плазма сервис
|
||||||
|
69
dialog.cpp
69
dialog.cpp
@ -490,8 +490,27 @@ void Dialog::mouseMoveEvent(QMouseEvent *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newWidth >= minimumSize().width()) && (newHeight >= minimumSize().height())) {
|
QRect newGeom(position, QSize(newWidth, newHeight));
|
||||||
setGeometry(QRect(position, QSize(newWidth, newHeight)));
|
|
||||||
|
// now sanity check the resize results again min constraints, if any
|
||||||
|
if (d->leftResizeMin > -1 && newGeom.left() > d->leftResizeMin) {
|
||||||
|
newGeom.setLeft(d->leftResizeMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->topResizeMin > -1 && newGeom.top() > d->topResizeMin) {
|
||||||
|
newGeom.setTop(d->topResizeMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->rightResizeMin > -1 && newGeom.right() < d->rightResizeMin) {
|
||||||
|
newGeom.setRight(d->rightResizeMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->bottomResizeMin > -1 && newGeom.bottom() < d->bottomResizeMin) {
|
||||||
|
newGeom.setBottom(d->bottomResizeMin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((newGeom.width() >= minimumSize().width()) && (newGeom.height() >= minimumSize().height())) {
|
||||||
|
setGeometry(newGeom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,9 +537,9 @@ void Dialog::mousePressEvent(QMouseEvent *event)
|
|||||||
void Dialog::mouseReleaseEvent(QMouseEvent *event)
|
void Dialog::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (d->resizeStartCorner != Dialog::NoCorner) {
|
if (d->resizeStartCorner != Dialog::NoCorner) {
|
||||||
|
emit dialogResized();
|
||||||
d->resizeStartCorner = Dialog::NoCorner;
|
d->resizeStartCorner = Dialog::NoCorner;
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
emit dialogResized();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget::mouseReleaseEvent(event);
|
QWidget::mouseReleaseEvent(event);
|
||||||
@ -535,12 +554,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,13 +764,45 @@ Dialog::ResizeCorners Dialog::resizeCorners() const
|
|||||||
return d->resizeCorners;
|
return d->resizeCorners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Dialog::isUserResizing() const
|
||||||
|
{
|
||||||
|
return d->resizeStartCorner > NoCorner;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::setMinimumResizeLimits(int left, int top, int right, int bottom)
|
||||||
|
{
|
||||||
|
d->leftResizeMin = left;
|
||||||
|
d->topResizeMin = top;
|
||||||
|
d->rightResizeMin = right;
|
||||||
|
d->bottomResizeMin = bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dialog::getMinimumResizeLimits(int *left, int *top, int *right, int *bottom)
|
||||||
|
{
|
||||||
|
if (left) {
|
||||||
|
*left = d->leftResizeMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top) {
|
||||||
|
*top = d->topResizeMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (right) {
|
||||||
|
*right = d->rightResizeMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bottom) {
|
||||||
|
*bottom = d->bottomResizeMin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Dialog::animatedHide(Plasma::Direction direction)
|
void Dialog::animatedHide(Plasma::Direction direction)
|
||||||
{
|
{
|
||||||
if (!isVisible()) {
|
if (!isVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!KWindowSystem::compositingActive()) {
|
if (!Plasma::Theme::defaultTheme()->windowTranslucencyEnabled()) {
|
||||||
hide();
|
hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -786,7 +831,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;
|
||||||
}
|
}
|
||||||
@ -810,7 +855,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
dialog.h
25
dialog.h
@ -97,6 +97,31 @@ class PLASMA_EXPORT Dialog : public QWidget
|
|||||||
*/
|
*/
|
||||||
ResizeCorners resizeCorners() const;
|
ResizeCorners resizeCorners() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if currently being resized by the user
|
||||||
|
*/
|
||||||
|
bool isUserResizing() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the minimum values that each of four sides of the rect may expand to or from
|
||||||
|
*
|
||||||
|
* @param left the screen coordinate that the left may not go beyond; -1 for no limit
|
||||||
|
* @param top the screen coordinate that the top may not go beyond; -1 for no limit
|
||||||
|
* @param right the screen coordinate that the right may not go beyond; -1 for no limit
|
||||||
|
* @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit
|
||||||
|
*/
|
||||||
|
void setMinimumResizeLimits(int left, int top, int right, int bottom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrives the minimum resize limits for the dialog
|
||||||
|
*
|
||||||
|
* @param left the screen coordinate that the left may not go beyond; -1 for no limit
|
||||||
|
* @param top the screen coordinate that the top may not go beyond; -1 for no limit
|
||||||
|
* @param right the screen coordinate that the right may not go beyond; -1 for no limit
|
||||||
|
* @param bottom the screen coordinate that the bottom may not go beyond; -1 for no limit
|
||||||
|
*/
|
||||||
|
void getMinimumResizeLimits(int *left, int *top, int *right, int *bottom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes an animated hide; requires compositing to work, otherwise
|
* Causes an animated hide; requires compositing to work, otherwise
|
||||||
* the dialog will simply hide.
|
* the dialog will simply hide.
|
||||||
|
@ -509,7 +509,8 @@ bool Package::installPackage(const QString &package,
|
|||||||
if (mimetype->is("application/zip")) {
|
if (mimetype->is("application/zip")) {
|
||||||
archive = new KZip(package);
|
archive = new KZip(package);
|
||||||
} else if (mimetype->is("application/x-compressed-tar") ||
|
} else if (mimetype->is("application/x-compressed-tar") ||
|
||||||
mimetype->is("application/x-tar")|| mimetype->is("application/x-bzip-compressed-tar")) {
|
mimetype->is("application/x-tar")|| mimetype->is("application/x-bzip-compressed-tar") ||
|
||||||
|
mimetype->is("application/x-xz") || mimetype->is("application/x-lzma")) {
|
||||||
archive = new KTar(package);
|
archive = new KTar(package);
|
||||||
} else {
|
} else {
|
||||||
kWarning() << "Could not open package file, unsupported archive format:" << package << mimetype->name();
|
kWarning() << "Could not open package file, unsupported archive format:" << package << mimetype->name();
|
||||||
|
@ -94,7 +94,9 @@ void PackageMetadata::write(const QString &filename) const
|
|||||||
config.writeEntry("Icon", d->icon);
|
config.writeEntry("Icon", d->icon);
|
||||||
config.writeEntry("Comment", d->description);
|
config.writeEntry("Comment", d->description);
|
||||||
config.writeEntry("Keywords", d->keywords);
|
config.writeEntry("Keywords", d->keywords);
|
||||||
|
config.deleteEntry("X-KDE-Keywords");
|
||||||
config.writeEntry("X-KDE-ServiceTypes", d->serviceType);
|
config.writeEntry("X-KDE-ServiceTypes", d->serviceType);
|
||||||
|
config.deleteEntry("ServiceTypes");
|
||||||
config.writeEntry("X-KDE-PluginInfo-Name", d->pluginName);
|
config.writeEntry("X-KDE-PluginInfo-Name", d->pluginName);
|
||||||
config.writeEntry("X-KDE-PluginInfo-Author", d->author);
|
config.writeEntry("X-KDE-PluginInfo-Author", d->author);
|
||||||
config.writeEntry("X-KDE-PluginInfo-Email", d->email);
|
config.writeEntry("X-KDE-PluginInfo-Email", d->email);
|
||||||
@ -120,8 +122,27 @@ void PackageMetadata::read(const QString &filename)
|
|||||||
d->name = config.readEntry("Name", d->name);
|
d->name = config.readEntry("Name", d->name);
|
||||||
d->icon = config.readEntry("Icon", d->icon);
|
d->icon = config.readEntry("Icon", d->icon);
|
||||||
d->description = config.readEntry("Comment", d->description);
|
d->description = config.readEntry("Comment", d->description);
|
||||||
|
bool hasKeywords = config.hasKey("Keywords");
|
||||||
|
bool hasXKdeKeywords = config.hasKey("X-KDE-Keywords");
|
||||||
|
if (hasKeywords && hasXKdeKeywords) {
|
||||||
d->keywords = config.readEntry("Keywords", d->keywords);
|
d->keywords = config.readEntry("Keywords", d->keywords);
|
||||||
|
d->keywords.append(config.readEntry("X-KDE-Keywords", d->keywords));
|
||||||
|
} else if (hasKeywords) {
|
||||||
|
d->keywords = config.readEntry("Keywords", d->keywords);
|
||||||
|
} else if (hasXKdeKeywords) {
|
||||||
|
d->keywords = config.readEntry("X-KDE-Keywords", d->keywords);
|
||||||
|
}
|
||||||
|
bool hasServiceTypes = config.hasKey("ServiceTypes");
|
||||||
|
bool hasXKdeServiceTypes = config.hasKey("X-KDE-ServiceTypes");
|
||||||
|
if (hasServiceTypes && hasXKdeServiceTypes) {
|
||||||
|
d->serviceType = config.readEntry("ServiceTypes", d->serviceType);
|
||||||
|
d->serviceType.append(',');
|
||||||
|
d->serviceType.append(config.readEntry("X-KDE-ServiceTypes", d->serviceType));
|
||||||
|
} else if (hasServiceTypes) {
|
||||||
|
d->serviceType = config.readEntry("ServiceTypes", d->serviceType);
|
||||||
|
} else if (hasXKdeServiceTypes) {
|
||||||
d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType);
|
d->serviceType = config.readEntry("X-KDE-ServiceTypes", d->serviceType);
|
||||||
|
}
|
||||||
d->pluginName = config.readEntry("X-KDE-PluginInfo-Name", d->pluginName);
|
d->pluginName = config.readEntry("X-KDE-PluginInfo-Name", d->pluginName);
|
||||||
d->author = config.readEntry("X-KDE-PluginInfo-Author", d->author);
|
d->author = config.readEntry("X-KDE-PluginInfo-Author", d->author);
|
||||||
d->email = config.readEntry("X-KDE-PluginInfo-Email", d->email);
|
d->email = config.readEntry("X-KDE-PluginInfo-Email", d->email);
|
||||||
|
@ -614,7 +614,7 @@ PackageMetadata PackageStructure::metadata()
|
|||||||
|
|
||||||
if (mimetype->is("application/zip")) {
|
if (mimetype->is("application/zip")) {
|
||||||
archive = new KZip(d->path);
|
archive = new KZip(d->path);
|
||||||
} else if (mimetype->is("application/x-compressed-tar") ||
|
} else if (mimetype->is("application/x-compressed-tar") || mimetype->is("application/x-gzip") ||
|
||||||
mimetype->is("application/x-tar")|| mimetype->is("application/x-bzip-compressed-tar")) {
|
mimetype->is("application/x-tar")|| mimetype->is("application/x-bzip-compressed-tar")) {
|
||||||
archive = new KTar(d->path);
|
archive = new KTar(d->path);
|
||||||
} else {
|
} else {
|
||||||
|
105
popupapplet.cpp
105
popupapplet.cpp
@ -446,7 +446,6 @@ QSizeF PopupApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) cons
|
|||||||
case Horizontal: {
|
case Horizontal: {
|
||||||
const int size = IconSize(KIconLoader::Panel);
|
const int size = IconSize(KIconLoader::Panel);
|
||||||
return QSizeF(size, size);
|
return QSizeF(size, size);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -601,6 +600,9 @@ void PopupApplet::timerEvent(QTimerEvent *event)
|
|||||||
d->autohideTimer->stop();
|
d->autohideTimer->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (event->timerId() == d->showDialogTimer.timerId()) {
|
||||||
|
d->showDialogTimer.stop();
|
||||||
|
d->showDialog();
|
||||||
} else {
|
} else {
|
||||||
Applet::timerEvent(event);
|
Applet::timerEvent(event);
|
||||||
}
|
}
|
||||||
@ -608,6 +610,7 @@ void PopupApplet::timerEvent(QTimerEvent *event)
|
|||||||
|
|
||||||
void PopupApplet::hidePopup()
|
void PopupApplet::hidePopup()
|
||||||
{
|
{
|
||||||
|
d->showDialogTimer.stop();
|
||||||
d->delayedShowTimer.stop();
|
d->delayedShowTimer.stop();
|
||||||
|
|
||||||
Dialog *dialog = d->dialogPtr.data();
|
Dialog *dialog = d->dialogPtr.data();
|
||||||
@ -749,6 +752,17 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ToolTipManager::self()->hide(q);
|
ToolTipManager::self()->hide(q);
|
||||||
|
showDialogTimer.start(0, q);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PopupAppletPrivate::showDialog()
|
||||||
|
{
|
||||||
|
Plasma::Dialog *dialog = dialogPtr.data();
|
||||||
|
if (!dialog) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updateDialogPosition();
|
updateDialogPosition();
|
||||||
|
|
||||||
KWindowSystem::setOnAllDesktops(dialog->winId(), true);
|
KWindowSystem::setOnAllDesktops(dialog->winId(), true);
|
||||||
@ -767,7 +781,6 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
|
|||||||
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) {
|
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) {
|
||||||
KWindowSystem::activateWindow(dialog->winId());
|
KWindowSystem::activateWindow(dialog->winId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupAppletPrivate::hideTimedPopup()
|
void PopupAppletPrivate::hideTimedPopup()
|
||||||
@ -800,7 +813,7 @@ void PopupAppletPrivate::dialogSizeChanged()
|
|||||||
sizeGroup.writeEntry("DialogHeight", dialog->height());
|
sizeGroup.writeEntry("DialogHeight", dialog->height());
|
||||||
sizeGroup.writeEntry("DialogWidth", dialog->width());
|
sizeGroup.writeEntry("DialogWidth", dialog->width());
|
||||||
|
|
||||||
updateDialogPosition();
|
updateDialogPosition(!dialog->isUserResizing());
|
||||||
|
|
||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
emit q->appletTransformedByUser();
|
emit q->appletTransformedByUser();
|
||||||
@ -890,7 +903,7 @@ void PopupAppletPrivate::restoreDialogSize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupAppletPrivate::updateDialogPosition()
|
void PopupAppletPrivate::updateDialogPosition(bool move)
|
||||||
{
|
{
|
||||||
Plasma::Dialog *dialog = dialogPtr.data();
|
Plasma::Dialog *dialog = dialogPtr.data();
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
@ -907,85 +920,57 @@ void PopupAppletPrivate::updateDialogPosition()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize s = dialog->size();
|
const QPoint appletPos = view->mapToGlobal(view->mapFromScene(q->scenePos()));
|
||||||
QPoint pos = view->mapFromScene(q->scenePos());
|
|
||||||
|
|
||||||
|
QPoint dialogPos;
|
||||||
if (!q->containment() || view == q->containment()->view()) {
|
if (!q->containment() || view == q->containment()->view()) {
|
||||||
pos = corona->popupPosition(q, s, popupAlignment);
|
kDebug() << "requesting with" << q->scenePos();
|
||||||
|
dialogPos = corona->popupPosition(q, dialog->size(), popupAlignment);
|
||||||
} else {
|
} else {
|
||||||
pos = corona->popupPosition(q->parentItem(), s, popupAlignment);
|
kDebug() << "requesting with" << q->parentItem();
|
||||||
|
dialogPos = corona->popupPosition(q->parentItem(), dialog->size(), popupAlignment);
|
||||||
}
|
}
|
||||||
|
kDebug() << "dialog position is" << dialogPos <<" with location" << q->location() << "<<<<<<<<<<<<<<<<<<<<<<<<";
|
||||||
|
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
if (q->formFactor() == Plasma::Vertical) {
|
if (q->formFactor() == Plasma::Vertical) {
|
||||||
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).y() + q->size().height()/2 < pos.y() + dialog->size().width()/2) {
|
reverse = (appletPos.y() + (q->size().height() / 2)) < (dialogPos.y() + (dialog->size().height() / 2));
|
||||||
reverse = true;
|
dialog->setMinimumResizeLimits(-1, appletPos.y(), -1, appletPos.y() + q->size().height());
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (view->mapToGlobal(view->mapFromScene(q->scenePos())).x() + q->size().width()/2 < pos.x() + dialog->size().width()/2) {
|
reverse = (appletPos.x() + (q->size().width() / 2)) < (dialogPos.x() + (dialog->size().width() / 2));
|
||||||
reverse = true;
|
dialog->setMinimumResizeLimits(appletPos.x(), -1, appletPos.x() + q->size().width(), -1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dialog::ResizeCorners resizeCorners = Dialog::NoCorner;
|
||||||
switch (q->location()) {
|
switch (q->location()) {
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
if (pos.x() >= q->pos().x()) {
|
resizeCorners = Dialog::NorthEast | Dialog::NorthWest;
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
popupPlacement = reverse ? TopPosedLeftAlignedPopup : TopPosedRightAlignedPopup;
|
||||||
} else {
|
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthWest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
popupPlacement = Plasma::TopPosedLeftAlignedPopup;
|
|
||||||
} else {
|
|
||||||
popupPlacement = Plasma::TopPosedRightAlignedPopup;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
if (pos.x() >= q->pos().x()) {
|
resizeCorners = Dialog::SouthEast | Dialog::SouthWest;
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthEast);
|
popupPlacement = reverse ? Plasma::BottomPosedLeftAlignedPopup : Plasma::BottomPosedRightAlignedPopup;
|
||||||
} else {
|
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthWest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
popupPlacement = Plasma::BottomPosedLeftAlignedPopup;
|
|
||||||
} else {
|
|
||||||
popupPlacement = Plasma::BottomPosedRightAlignedPopup;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
if (pos.y() >= q->pos().y()) {
|
resizeCorners = Dialog::SouthEast | Dialog::NorthEast;
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthEast);
|
popupPlacement = reverse ? RightPosedTopAlignedPopup : RightPosedBottomAlignedPopup;
|
||||||
} else {
|
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
popupPlacement = Plasma::RightPosedTopAlignedPopup;
|
|
||||||
} else {
|
|
||||||
popupPlacement = Plasma::RightPosedBottomAlignedPopup;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
if (pos.y() >= q->pos().y()) {
|
resizeCorners = Dialog::SouthWest | Dialog::NorthWest;
|
||||||
dialog->setResizeHandleCorners(Dialog::SouthWest);
|
popupPlacement = reverse ? LeftPosedTopAlignedPopup : LeftPosedBottomAlignedPopup;
|
||||||
} else {
|
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthWest);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
popupPlacement = Plasma::LeftPosedTopAlignedPopup;
|
|
||||||
} else {
|
|
||||||
popupPlacement = Plasma::LeftPosedBottomAlignedPopup;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
dialog->setResizeHandleCorners(Dialog::NorthEast);
|
popupPlacement = FloatingPopup;
|
||||||
|
resizeCorners = Dialog::All;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->move(pos);
|
dialog->setResizeHandleCorners(resizeCorners);
|
||||||
|
if (move) {
|
||||||
|
dialog->move(dialogPos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
@ -126,7 +126,6 @@ public:
|
|||||||
void destroyMessageOverlay();
|
void destroyMessageOverlay();
|
||||||
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);
|
||||||
@ -193,7 +192,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;
|
||||||
QString remoteLocation;
|
QString remoteLocation;
|
||||||
|
@ -100,9 +100,6 @@ void AssociatedApplicationManager::setApplication(Plasma::Applet *applet, const
|
|||||||
QString AssociatedApplicationManager::application(const Plasma::Applet *applet) const
|
QString AssociatedApplicationManager::application(const Plasma::Applet *applet) const
|
||||||
{
|
{
|
||||||
return d->applicationNames.value(applet);
|
return d->applicationNames.value(applet);
|
||||||
if (!d->applicationNames.contains(applet)) {
|
|
||||||
connect(applet, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupApplet(QObject *)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const KUrl::List &urls)
|
void AssociatedApplicationManager::setUrls(Plasma::Applet *applet, const KUrl::List &urls)
|
||||||
|
@ -40,6 +40,10 @@ public:
|
|||||||
view(0),
|
view(0),
|
||||||
resizeCorners(Dialog::NoCorner),
|
resizeCorners(Dialog::NoCorner),
|
||||||
resizeStartCorner(Dialog::NoCorner),
|
resizeStartCorner(Dialog::NoCorner),
|
||||||
|
leftResizeMin(-1),
|
||||||
|
topResizeMin(-1),
|
||||||
|
rightResizeMin(-1),
|
||||||
|
bottomResizeMin(-1),
|
||||||
moveTimer(0),
|
moveTimer(0),
|
||||||
aspectRatioMode(Plasma::IgnoreAspectRatio),
|
aspectRatioMode(Plasma::IgnoreAspectRatio),
|
||||||
resizeChecksWithBorderCheck(false)
|
resizeChecksWithBorderCheck(false)
|
||||||
@ -72,6 +76,10 @@ public:
|
|||||||
Dialog::ResizeCorners resizeCorners;
|
Dialog::ResizeCorners resizeCorners;
|
||||||
QMap<Dialog::ResizeCorner, QRect> resizeAreas;
|
QMap<Dialog::ResizeCorner, QRect> resizeAreas;
|
||||||
int resizeStartCorner;
|
int resizeStartCorner;
|
||||||
|
int leftResizeMin;
|
||||||
|
int topResizeMin;
|
||||||
|
int rightResizeMin;
|
||||||
|
int bottomResizeMin;
|
||||||
QTimer *moveTimer;
|
QTimer *moveTimer;
|
||||||
QTimer *adjustViewTimer;
|
QTimer *adjustViewTimer;
|
||||||
QTimer *adjustSizeTimer;
|
QTimer *adjustSizeTimer;
|
||||||
|
@ -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;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h> // FLT_MAX
|
#include <float.h> // FLT_MAX
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include <kconfiggroup.h>
|
#include <kconfiggroup.h>
|
||||||
@ -82,7 +83,10 @@ PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
|||||||
PlasmoidPackage::~PlasmoidPackage()
|
PlasmoidPackage::~PlasmoidPackage()
|
||||||
{
|
{
|
||||||
#ifndef PLASMA_NO_KNEWSTUFF
|
#ifndef PLASMA_NO_KNEWSTUFF
|
||||||
|
if (!QCoreApplication::closingDown()) {
|
||||||
|
// let it "leak" on application close as this causes crashes otherwise, BUG 288153
|
||||||
delete m_knsDialog.data();
|
delete m_knsDialog.data();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +107,7 @@ void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
|
|||||||
KNS3::DownloadDialog *knsDialog = m_knsDialog.data();
|
KNS3::DownloadDialog *knsDialog = m_knsDialog.data();
|
||||||
if (!knsDialog) {
|
if (!knsDialog) {
|
||||||
m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent);
|
m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent);
|
||||||
|
knsDialog->setProperty("DoNotCloseController", true);
|
||||||
connect(knsDialog, SIGNAL(accepted()), this, SIGNAL(newWidgetBrowserFinished()));
|
connect(knsDialog, SIGNAL(accepted()), this, SIGNAL(newWidgetBrowserFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,13 @@ public:
|
|||||||
|
|
||||||
void iconSizeChanged(int group);
|
void iconSizeChanged(int group);
|
||||||
void internalTogglePopup(bool fromActivatedSignal = false);
|
void internalTogglePopup(bool fromActivatedSignal = false);
|
||||||
|
void showDialog();
|
||||||
void hideTimedPopup();
|
void hideTimedPopup();
|
||||||
void clearPopupLostFocus();
|
void clearPopupLostFocus();
|
||||||
void dialogSizeChanged();
|
void dialogSizeChanged();
|
||||||
void dialogStatusChanged(bool status);
|
void dialogStatusChanged(bool status);
|
||||||
void restoreDialogSize();
|
void restoreDialogSize();
|
||||||
void updateDialogPosition();
|
void updateDialogPosition(bool move = true);
|
||||||
void popupConstraintsEvent(Plasma::Constraints constraints);
|
void popupConstraintsEvent(Plasma::Constraints constraints);
|
||||||
void checkExtenderAppearance(Plasma::FormFactor f);
|
void checkExtenderAppearance(Plasma::FormFactor f);
|
||||||
KConfigGroup popupConfigGroup();
|
KConfigGroup popupConfigGroup();
|
||||||
@ -61,6 +62,7 @@ public:
|
|||||||
Plasma::AspectRatioMode savedAspectRatio;
|
Plasma::AspectRatioMode savedAspectRatio;
|
||||||
QTimer *autohideTimer;
|
QTimer *autohideTimer;
|
||||||
QBasicTimer delayedShowTimer;
|
QBasicTimer delayedShowTimer;
|
||||||
|
QBasicTimer showDialogTimer;
|
||||||
QPoint clicked;
|
QPoint clicked;
|
||||||
ItemStatus preShowStatus;
|
ItemStatus preShowStatus;
|
||||||
bool popupLostFocus : 1;
|
bool popupLostFocus : 1;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
if (!textBox) {
|
if (!textBox) {
|
||||||
textBox = new Plasma::FrameSvg(q);
|
textBox = new Plasma::FrameSvg(q);
|
||||||
textBox->setImagePath("widgets/lineedit");
|
textBox->setImagePath("widgets/lineedit");
|
||||||
textBox->setElementPrefix("sunken");
|
textBox->setElementPrefix("base");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,6 @@ void Style::drawComplexControl(ComplexControl control,
|
|||||||
case CC_SpinBox: {
|
case CC_SpinBox: {
|
||||||
d->createTextBox();
|
d->createTextBox();
|
||||||
|
|
||||||
d->textBox->setElementPrefix("base");
|
|
||||||
d->textBox->resizeFrame(option->rect.size());
|
d->textBox->resizeFrame(option->rect.size());
|
||||||
d->textBox->paintFrame(painter);
|
d->textBox->paintFrame(painter);
|
||||||
|
|
||||||
@ -252,7 +251,6 @@ void Style::drawComplexControl(ComplexControl control,
|
|||||||
qApp->style()->drawComplexControl(control, option, painter, widget);
|
qApp->style()->drawComplexControl(control, option, painter, widget);
|
||||||
} else {
|
} else {
|
||||||
d->createTextBox();
|
d->createTextBox();
|
||||||
d->textBox->setElementPrefix("base");
|
|
||||||
d->textBox->resizeFrame(option->rect.size());
|
d->textBox->resizeFrame(option->rect.size());
|
||||||
d->textBox->paintFrame(painter);
|
d->textBox->paintFrame(painter);
|
||||||
|
|
||||||
@ -283,7 +281,6 @@ void Style::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
|||||||
}
|
}
|
||||||
d->createTextBox();
|
d->createTextBox();
|
||||||
|
|
||||||
d->textBox->setElementPrefix("base");
|
|
||||||
d->textBox->resizeFrame(option->rect.size());
|
d->textBox->resizeFrame(option->rect.size());
|
||||||
d->textBox->paintFrame(painter);
|
d->textBox->paintFrame(painter);
|
||||||
break;
|
break;
|
||||||
@ -306,12 +303,13 @@ QRect Style::subControlRect(ComplexControl control, const QStyleOptionComplex *o
|
|||||||
rect.moveCenter(QPoint(option->rect.center().x(), rect.center().y()));
|
rect.moveCenter(QPoint(option->rect.center().x(), rect.center().y()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rect;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return rect;
|
break;
|
||||||
}
|
}
|
||||||
|
return rect;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Style::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
|
int Style::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
|
||||||
@ -350,7 +348,6 @@ QRect Style::subElementRect(SubElement element, const QStyleOption *option, cons
|
|||||||
switch (element) {
|
switch (element) {
|
||||||
case SE_LineEditContents: {
|
case SE_LineEditContents: {
|
||||||
d->createTextBox();
|
d->createTextBox();
|
||||||
d->textBox->setElementPrefix("base");
|
|
||||||
|
|
||||||
qreal left, top, right, bottom;
|
qreal left, top, right, bottom;
|
||||||
d->textBox->getMargins(left, top, right, bottom);
|
d->textBox->getMargins(left, top, right, bottom);
|
||||||
@ -365,9 +362,15 @@ QSize Style::sizeFromContents(ContentsType type, const QStyleOption *option,
|
|||||||
const QSize &contentsSize, const QWidget *widget) const
|
const QSize &contentsSize, const QWidget *widget) const
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case CT_SpinBox: {
|
||||||
|
d->createTextBox();
|
||||||
|
|
||||||
|
qreal left, top, right, bottom;
|
||||||
|
d->textBox->getMargins(left, top, right, bottom);
|
||||||
|
return contentsSize + QSize(left + right - 2, top + bottom - 2);
|
||||||
|
}
|
||||||
case CT_LineEdit: {
|
case CT_LineEdit: {
|
||||||
d->createTextBox();
|
d->createTextBox();
|
||||||
d->textBox->setElementPrefix("base");
|
|
||||||
|
|
||||||
qreal left, top, right, bottom;
|
qreal left, top, right, bottom;
|
||||||
d->textBox->getMargins(left, top, right, bottom);
|
d->textBox->getMargins(left, top, right, bottom);
|
||||||
@ -376,7 +379,6 @@ QSize Style::sizeFromContents(ContentsType type, const QStyleOption *option,
|
|||||||
default:
|
default:
|
||||||
return qApp->style()->sizeFromContents(type, option, contentsSize, widget);
|
return qApp->style()->sizeFromContents(type, option, contentsSize, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
85
private/themedwidgetinterface.cpp
Normal file
85
private/themedwidgetinterface.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Copyright 2011 by Aaron Seigo <aseigo@kde.org> *
|
||||||
|
* *
|
||||||
|
* This library is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU Library General Public *
|
||||||
|
* License as published by the Free Software Foundation; either *
|
||||||
|
* version 2 of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This library is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||||
|
* Library General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU Library General Public License *
|
||||||
|
* along with this library; see the file COPYING.LIB. If not, write to *
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
||||||
|
* Boston, MA 02110-1301, USA. *
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include "themedwidgetinterface_p.h"
|
||||||
|
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
|
PaletteHelper *PaletteHelper::s_paletteHelper = 0;
|
||||||
|
|
||||||
|
PaletteHelper::PaletteHelper()
|
||||||
|
: QObject()
|
||||||
|
{
|
||||||
|
generatePalettes();
|
||||||
|
connect(Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(generatePalettes()));
|
||||||
|
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(generatePalettes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
PaletteHelper *PaletteHelper::self()
|
||||||
|
{
|
||||||
|
if (!s_paletteHelper) {
|
||||||
|
s_paletteHelper = new PaletteHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_paletteHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaletteHelper::generatePalettes()
|
||||||
|
{
|
||||||
|
Theme *theme = Theme::defaultTheme();
|
||||||
|
|
||||||
|
QColor color = theme->color(Theme::TextColor);
|
||||||
|
palette = qApp->palette();
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::WindowText, color);
|
||||||
|
palette.setColor(QPalette::Inactive, QPalette::WindowText, color);
|
||||||
|
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::Link, theme->color(Theme::LinkColor));
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::LinkVisited, theme->color(Theme::VisitedLinkColor));
|
||||||
|
|
||||||
|
qreal alpha = color.alphaF();
|
||||||
|
color.setAlphaF(0.6);
|
||||||
|
palette.setColor(QPalette::Disabled, QPalette::WindowText, color);
|
||||||
|
color.setAlphaF(alpha);
|
||||||
|
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::Text, color);
|
||||||
|
palette.setColor(QPalette::Inactive, QPalette::Text, color);
|
||||||
|
|
||||||
|
const QColor buttonColor = Theme::defaultTheme()->color(Theme::ButtonTextColor);
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::ButtonText, buttonColor);
|
||||||
|
palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonColor);
|
||||||
|
|
||||||
|
//FIXME: hardcoded colors .. looks incorrect
|
||||||
|
palette.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
||||||
|
palette.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
||||||
|
|
||||||
|
buttonPalette = palette;
|
||||||
|
buttonPalette.setColor(QPalette::Normal, QPalette::Text, buttonColor);
|
||||||
|
buttonPalette.setColor(QPalette::Inactive, QPalette::Text, buttonColor);
|
||||||
|
|
||||||
|
emit palettesUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Plasma
|
||||||
|
|
||||||
|
#include "themedwidgetinterface_p.moc"
|
||||||
|
|
@ -28,6 +28,28 @@
|
|||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class PaletteHelper : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static PaletteHelper *self();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void generatePalettes();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void palettesUpdated();
|
||||||
|
|
||||||
|
public:
|
||||||
|
QPalette palette;
|
||||||
|
QPalette buttonPalette;
|
||||||
|
|
||||||
|
private:
|
||||||
|
PaletteHelper();
|
||||||
|
static PaletteHelper *s_paletteHelper;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class ThemedWidgetInterface
|
class ThemedWidgetInterface
|
||||||
{
|
{
|
||||||
@ -36,10 +58,10 @@ public:
|
|||||||
: q(publicClass),
|
: q(publicClass),
|
||||||
customPalette(false),
|
customPalette(false),
|
||||||
customFont(false),
|
customFont(false),
|
||||||
buttonColorForText(false)
|
buttonColorForText(false),
|
||||||
|
internalPaletteChange(false)
|
||||||
{
|
{
|
||||||
QObject::connect(Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(setPalette()));
|
QObject::connect(PaletteHelper::self(), SIGNAL(palettesUpdated()), q, SLOT(setPalette()));
|
||||||
QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(setPalette()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTheming()
|
void initTheming()
|
||||||
@ -52,33 +74,10 @@ public:
|
|||||||
void setPalette()
|
void setPalette()
|
||||||
{
|
{
|
||||||
if (!customPalette) {
|
if (!customPalette) {
|
||||||
QColor color = Theme::defaultTheme()->color(Theme::TextColor);
|
internalPaletteChange = true;
|
||||||
QPalette p = q->palette();
|
q->setPalette((buttonColorForText ? PaletteHelper::self()->buttonPalette
|
||||||
p.setColor(QPalette::Normal, QPalette::WindowText, color);
|
: PaletteHelper::self()->palette));
|
||||||
p.setColor(QPalette::Inactive, QPalette::WindowText, color);
|
internalPaletteChange = false;
|
||||||
|
|
||||||
p.setColor(QPalette::Normal, QPalette::Link, Theme::defaultTheme()->color(Theme::LinkColor));
|
|
||||||
p.setColor(QPalette::Normal, QPalette::LinkVisited, Theme::defaultTheme()->color(Theme::VisitedLinkColor));
|
|
||||||
|
|
||||||
|
|
||||||
qreal alpha = color.alphaF();
|
|
||||||
color.setAlphaF(0.6);
|
|
||||||
p.setColor(QPalette::Disabled, QPalette::WindowText, color);
|
|
||||||
color.setAlphaF(alpha);
|
|
||||||
|
|
||||||
const QColor buttonColor = Theme::defaultTheme()->color(Theme::ButtonTextColor);
|
|
||||||
p.setColor(QPalette::Normal, QPalette::Text, buttonColorForText ? buttonColor : color);
|
|
||||||
p.setColor(QPalette::Inactive, QPalette::Text, buttonColorForText ? buttonColor : color);
|
|
||||||
|
|
||||||
p.setColor(QPalette::Normal, QPalette::ButtonText, buttonColor);
|
|
||||||
p.setColor(QPalette::Inactive, QPalette::ButtonText, buttonColor);
|
|
||||||
|
|
||||||
//FIXME: hardcoded colors .. looks incorrect
|
|
||||||
p.setColor(QPalette::Normal, QPalette::Base, QColor(0,0,0,0));
|
|
||||||
p.setColor(QPalette::Inactive, QPalette::Base, QColor(0,0,0,0));
|
|
||||||
|
|
||||||
q->setPalette(p);
|
|
||||||
customPalette = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!customFont) {
|
if (!customFont) {
|
||||||
@ -95,7 +94,10 @@ public:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case QEvent::PaletteChange:
|
case QEvent::PaletteChange:
|
||||||
|
if (!internalPaletteChange &&
|
||||||
|
q->palette() != (buttonColorForText ? PaletteHelper::self()->buttonPalette : PaletteHelper::self()->palette)) {
|
||||||
customPalette = true;
|
customPalette = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -103,6 +105,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setWidget(QWidget *widget)
|
||||||
|
{
|
||||||
|
internalPaletteChange = true;
|
||||||
|
q->setWidget(widget);
|
||||||
|
internalPaletteChange = false;
|
||||||
|
}
|
||||||
|
|
||||||
void event(QEvent *event)
|
void event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::Show) {
|
if (event->type() == QEvent::Show) {
|
||||||
@ -114,6 +123,7 @@ public:
|
|||||||
bool customPalette : 1;
|
bool customPalette : 1;
|
||||||
bool customFont : 1;
|
bool customFont : 1;
|
||||||
bool buttonColorForText : 1;
|
bool buttonColorForText : 1;
|
||||||
|
bool internalPaletteChange : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Plasma
|
} // namespace Plasma
|
||||||
|
@ -356,10 +356,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
@ -85,8 +85,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),
|
||||||
@ -97,27 +98,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)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveTimer = new QTimer(q);
|
QObject::connect(s_blurEffectWatcher, SIGNAL(effectChanged(bool)), q, SLOT(blurBehindChanged(bool)));
|
||||||
saveTimer->setSingleShot(true);
|
#endif
|
||||||
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()
|
||||||
@ -144,6 +150,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();
|
||||||
@ -159,6 +167,9 @@ public:
|
|||||||
static const char *systemColorsTheme;
|
static const char *systemColorsTheme;
|
||||||
static const char *themeRcFile;
|
static const char *themeRcFile;
|
||||||
static PackageStructure::Ptr packageStructure;
|
static PackageStructure::Ptr packageStructure;
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
static EffectWatcher *s_blurEffectWatcher;
|
||||||
|
#endif
|
||||||
|
|
||||||
Theme *q;
|
Theme *q;
|
||||||
QString themeName;
|
QString themeName;
|
||||||
@ -183,10 +194,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;
|
||||||
@ -203,6 +214,9 @@ 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";
|
||||||
|
#ifdef Q_WS_X11
|
||||||
|
EffectWatcher *ThemePrivate::s_blurEffectWatcher = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool ThemePrivate::useCache()
|
bool ThemePrivate::useCache()
|
||||||
{
|
{
|
||||||
@ -270,8 +284,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
|
||||||
}
|
}
|
||||||
@ -324,17 +338,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)
|
||||||
{
|
{
|
||||||
|
if (blurActive != blur) {
|
||||||
blurActive = blur;
|
blurActive = blur;
|
||||||
discardCache(PixmapCache | SvgElementsCache);
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +536,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)
|
||||||
@ -670,9 +701,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
|
||||||
@ -685,7 +714,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
|
||||||
kDebug() << "Theme says: bad image path " << name;
|
//kDebug() << "Theme says: bad image path " << name;
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,7 +987,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1082,6 +1111,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
@ -379,6 +379,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
|
||||||
@ -404,6 +409,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
|
||||||
|
@ -140,21 +140,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");
|
|
||||||
KConfigGroup cg(&config, "PlasmaToolTips");
|
|
||||||
delay = cg.readEntry("Delay", qreal(0.7));
|
|
||||||
if (delay < 0) {
|
|
||||||
return;
|
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) {
|
||||||
@ -214,6 +211,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);
|
||||||
}
|
}
|
||||||
@ -249,6 +253,11 @@ void ToolTipManager::setContent(QGraphicsWidget *widget, const ToolTipContent &d
|
|||||||
//look if the data prefers aother graphicswidget, otherwise use the one used as event catcher
|
//look if the data prefers aother graphicswidget, otherwise use the one used as event catcher
|
||||||
QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget;
|
QGraphicsWidget *referenceWidget = data.graphicsWidget() ? data.graphicsWidget() : widget;
|
||||||
Corona *corona = qobject_cast<Corona *>(referenceWidget->scene());
|
Corona *corona = qobject_cast<Corona *>(referenceWidget->scene());
|
||||||
|
if (!corona) {
|
||||||
|
// fallback to the corona we were given
|
||||||
|
corona = m_corona;
|
||||||
|
}
|
||||||
|
|
||||||
if (corona) {
|
if (corona) {
|
||||||
d->tipWidget->moveTo(corona->popupPosition(referenceWidget, d->tipWidget->size(), Qt::AlignCenter));
|
d->tipWidget->moveTo(corona->popupPosition(referenceWidget, d->tipWidget->size(), Qt::AlignCenter));
|
||||||
}
|
}
|
||||||
@ -345,15 +354,14 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTipManagerPrivate::showToolTip()
|
void ToolTipManagerPrivate::showToolTip()
|
||||||
@ -404,6 +412,11 @@ void ToolTipManagerPrivate::showToolTip()
|
|||||||
tipWidget->prepareShowing();
|
tipWidget->prepareShowing();
|
||||||
QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget() ? tooltip.value().graphicsWidget() : currentWidget;
|
QGraphicsWidget *referenceWidget = tooltip.value().graphicsWidget() ? tooltip.value().graphicsWidget() : currentWidget;
|
||||||
Corona *corona = qobject_cast<Corona *>(referenceWidget->scene());
|
Corona *corona = qobject_cast<Corona *>(referenceWidget->scene());
|
||||||
|
if (!corona) {
|
||||||
|
// fallback to the corona we were given
|
||||||
|
corona = q->m_corona;
|
||||||
|
}
|
||||||
|
|
||||||
if (corona) {
|
if (corona) {
|
||||||
tipWidget->moveTo(corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter));
|
tipWidget->moveTo(corona->popupPosition(referenceWidget, tipWidget->size(), Qt::AlignCenter));
|
||||||
}
|
}
|
||||||
|
4
view.cpp
4
view.cpp
@ -186,8 +186,8 @@ void View::setScreen(int screen, int desktop)
|
|||||||
|
|
||||||
// handle views that are working with panel containment types
|
// handle views that are working with panel containment types
|
||||||
if (d->containment &&
|
if (d->containment &&
|
||||||
(d->containment->type() == Containment::PanelContainment ||
|
(d->containment->containmentType() == Containment::PanelContainment ||
|
||||||
d->containment->type() == Containment::CustomPanelContainment)) {
|
d->containment->containmentType() == Containment::CustomPanelContainment)) {
|
||||||
d->containment->setScreen(screen, desktop);
|
d->containment->setScreen(screen, desktop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ CheckBox::CheckBox(QGraphicsWidget *parent)
|
|||||||
{
|
{
|
||||||
QCheckBox *native = new QCheckBox;
|
QCheckBox *native = new QCheckBox;
|
||||||
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
native->setWindowIcon(QIcon());
|
native->setWindowIcon(QIcon());
|
||||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void ComboBox::setNativeWidget(KComboBox *nativeWidget)
|
|||||||
connect(nativeWidget, SIGNAL(currentIndexChanged(const QString &)),
|
connect(nativeWidget, SIGNAL(currentIndexChanged(const QString &)),
|
||||||
this, SIGNAL(textChanged(const QString &)));
|
this, SIGNAL(textChanged(const QString &)));
|
||||||
|
|
||||||
setWidget(nativeWidget);
|
d->setWidget(nativeWidget);
|
||||||
nativeWidget->setWindowIcon(QIcon());
|
nativeWidget->setWindowIcon(QIcon());
|
||||||
|
|
||||||
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
@ -50,7 +50,7 @@ GroupBox::GroupBox(QGraphicsWidget *parent)
|
|||||||
d(new GroupBoxPrivate(this))
|
d(new GroupBoxPrivate(this))
|
||||||
{
|
{
|
||||||
QGroupBox *native = new QGroupBox;
|
QGroupBox *native = new QGroupBox;
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
native->setWindowIcon(QIcon());
|
native->setWindowIcon(QIcon());
|
||||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
d->initTheming();
|
d->initTheming();
|
||||||
|
@ -644,15 +644,25 @@ void IconWidget::setSvg(const QString &svgFilePath, const QString &elementId)
|
|||||||
if (!d->iconSvg) {
|
if (!d->iconSvg) {
|
||||||
d->iconSvg = new Plasma::Svg(this);
|
d->iconSvg = new Plasma::Svg(this);
|
||||||
connect(d->iconSvg, SIGNAL(repaintNeeded()), this, SLOT(svgChanged()));
|
connect(d->iconSvg, SIGNAL(repaintNeeded()), this, SLOT(svgChanged()));
|
||||||
|
d->oldIcon = d->icon;
|
||||||
|
} else {
|
||||||
|
d->oldIcon = d->iconSvg->pixmap(d->iconSvgElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->iconSvg->setImagePath(svgFilePath);
|
d->iconSvg->setImagePath(svgFilePath);
|
||||||
d->iconSvg->setContainsMultipleImages(!elementId.isNull());
|
d->iconSvg->setContainsMultipleImages(!elementId.isNull());
|
||||||
d->iconSvgElement = elementId;
|
d->iconSvgElement = elementId;
|
||||||
d->iconSvgElementChanged = true;
|
d->iconSvgElementChanged = true;
|
||||||
d->icon = QIcon();
|
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|
||||||
|
if (!(d->states & IconWidgetPrivate::HoverState) && !d->iconChangeTimer->isActive() && !d->oldIcon.isNull()) {
|
||||||
|
d->animateMainIcon(true, d->states);
|
||||||
|
} else {
|
||||||
|
d->oldIcon = QIcon();
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
d->iconChangeTimer->start(300);
|
||||||
|
d->icon = QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IconWidget::svg() const
|
QString IconWidget::svg() const
|
||||||
@ -741,20 +751,19 @@ void IconWidgetPrivate::animateMainIcon(bool show, const IconWidgetStates state)
|
|||||||
QPropertyAnimation *animation = hoverAnimation->animation();
|
QPropertyAnimation *animation = hoverAnimation->animation();
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
animation = new QPropertyAnimation(hoverAnimation, "value");
|
animation = new QPropertyAnimation(hoverAnimation, "value");
|
||||||
animation->setProperty("duration", 150);
|
animation->setDuration(150);
|
||||||
animation->setProperty("easingCurve", QEasingCurve::OutQuad);
|
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||||
animation->setProperty("startValue", 0.0);
|
animation->setStartValue(0.0);
|
||||||
animation->setProperty("endValue", 1.0);
|
animation->setEndValue(1.0);
|
||||||
hoverAnimation->setAnimation(animation);
|
hoverAnimation->setAnimation(animation);
|
||||||
q->connect(animation, SIGNAL(finished()), q, SLOT(hoverAnimationFinished()));
|
q->connect(animation, SIGNAL(finished()), q, SLOT(hoverAnimationFinished()));
|
||||||
} else if (animation->state() == QAbstractAnimation::Running) {
|
} else if (animation->state() == QAbstractAnimation::Running) {
|
||||||
animation->pause();
|
animation->pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
animation->setProperty("direction", show ?
|
animation->setDirection(show ? QAbstractAnimation::Forward : QAbstractAnimation::Backward);
|
||||||
QAbstractAnimation::Forward : QAbstractAnimation::Backward);
|
animation->start(show ? QAbstractAnimation::KeepWhenStopped : QAbstractAnimation::DeleteWhenStopped);
|
||||||
animation->start(show ?
|
q->update();
|
||||||
QAbstractAnimation::KeepWhenStopped : QAbstractAnimation::DeleteWhenStopped);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconWidgetPrivate::hoverAnimationFinished()
|
void IconWidgetPrivate::hoverAnimationFinished()
|
||||||
@ -1458,7 +1467,6 @@ void IconWidget::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
d->oldIcon = QIcon();
|
d->oldIcon = QIcon();
|
||||||
d->animateMainIcon(true, d->states|IconWidgetPrivate::HoverState);
|
d->animateMainIcon(true, d->states|IconWidgetPrivate::HoverState);
|
||||||
update();
|
|
||||||
|
|
||||||
QGraphicsWidget::hoverEnterEvent(event);
|
QGraphicsWidget::hoverEnterEvent(event);
|
||||||
}
|
}
|
||||||
@ -1475,7 +1483,6 @@ void IconWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
d->states &= ~IconWidgetPrivate::PressedState;
|
d->states &= ~IconWidgetPrivate::PressedState;
|
||||||
|
|
||||||
d->animateMainIcon(false, d->states|IconWidgetPrivate::HoverState);
|
d->animateMainIcon(false, d->states|IconWidgetPrivate::HoverState);
|
||||||
update();
|
|
||||||
|
|
||||||
QGraphicsWidget::hoverLeaveEvent(event);
|
QGraphicsWidget::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
@ -1486,10 +1493,8 @@ bool IconWidget::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
|||||||
|
|
||||||
if (event->type() == QEvent::GraphicsSceneDragEnter) {
|
if (event->type() == QEvent::GraphicsSceneDragEnter) {
|
||||||
d->animateMainIcon(true, d->states|IconWidgetPrivate::HoverState);
|
d->animateMainIcon(true, d->states|IconWidgetPrivate::HoverState);
|
||||||
update();
|
|
||||||
} else if (event->type() == QEvent::GraphicsSceneDragLeave) {
|
} else if (event->type() == QEvent::GraphicsSceneDragLeave) {
|
||||||
d->animateMainIcon(false, d->states|IconWidgetPrivate::HoverState);
|
d->animateMainIcon(false, d->states|IconWidgetPrivate::HoverState);
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -105,7 +105,7 @@ Label::Label(QGraphicsWidget *parent)
|
|||||||
connect(native, SIGNAL(linkActivated(QString)), this, SIGNAL(linkActivated(QString)));
|
connect(native, SIGNAL(linkActivated(QString)), this, SIGNAL(linkActivated(QString)));
|
||||||
connect(native, SIGNAL(linkHovered(QString)), this, SIGNAL(linkHovered(QString)));
|
connect(native, SIGNAL(linkHovered(QString)), this, SIGNAL(linkHovered(QString)));
|
||||||
|
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
d->initTheming();
|
d->initTheming();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void LineEdit::setNativeWidget(KLineEdit *nativeWidget)
|
|||||||
|
|
||||||
|
|
||||||
nativeWidget->setWindowFlags(nativeWidget->windowFlags()|Qt::BypassGraphicsProxyWidget);
|
nativeWidget->setWindowFlags(nativeWidget->windowFlags()|Qt::BypassGraphicsProxyWidget);
|
||||||
setWidget(nativeWidget);
|
d->setWidget(nativeWidget);
|
||||||
nativeWidget->setWindowIcon(QIcon());
|
nativeWidget->setWindowIcon(QIcon());
|
||||||
|
|
||||||
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
@ -77,7 +77,7 @@ RadioButton::RadioButton(QGraphicsWidget *parent)
|
|||||||
{
|
{
|
||||||
QRadioButton *native = new QRadioButton;
|
QRadioButton *native = new QRadioButton;
|
||||||
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
connect(native, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
native->setWindowIcon(QIcon());
|
native->setWindowIcon(QIcon());
|
||||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
d->initTheming();
|
d->initTheming();
|
||||||
|
@ -933,7 +933,7 @@ void SignalPlotter::drawPlots(QPainter *p, int top, int w, int h, int horizontal
|
|||||||
qMax(prev_prev_datapoints[j],
|
qMax(prev_prev_datapoints[j],
|
||||||
prev_prev_prev_datapoints[j])));
|
prev_prev_prev_datapoints[j])));
|
||||||
double current_minvalue =
|
double current_minvalue =
|
||||||
qMin(datapoints[j],
|
qMin<double>(datapoints[j],
|
||||||
qMin(prev_datapoints[j],
|
qMin(prev_datapoints[j],
|
||||||
qMin(prev_prev_datapoints[j],
|
qMin(prev_prev_datapoints[j],
|
||||||
prev_prev_prev_datapoints[j])));
|
prev_prev_prev_datapoints[j])));
|
||||||
|
@ -67,7 +67,7 @@ SpinBox::SpinBox(QGraphicsWidget *parent)
|
|||||||
|
|
||||||
d->focusIndicator = new FocusIndicator(this, "widgets/lineedit");
|
d->focusIndicator = new FocusIndicator(this, "widgets/lineedit");
|
||||||
|
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
native->setWindowIcon(QIcon());
|
native->setWindowIcon(QIcon());
|
||||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
native->setAutoFillBackground(false);
|
native->setAutoFillBackground(false);
|
||||||
|
@ -40,7 +40,6 @@ class TextBrowserPrivate : public ThemedWidgetInterface<TextBrowser>
|
|||||||
public:
|
public:
|
||||||
TextBrowserPrivate(TextBrowser *browser)
|
TextBrowserPrivate(TextBrowser *browser)
|
||||||
: ThemedWidgetInterface<TextBrowser>(browser),
|
: ThemedWidgetInterface<TextBrowser>(browser),
|
||||||
native(0),
|
|
||||||
savedMinimumHeight(0),
|
savedMinimumHeight(0),
|
||||||
savedMaximumHeight(QWIDGETSIZE_MAX),
|
savedMaximumHeight(QWIDGETSIZE_MAX),
|
||||||
wasNotFixed(true)
|
wasNotFixed(true)
|
||||||
@ -49,7 +48,8 @@ public:
|
|||||||
|
|
||||||
void setFixedHeight()
|
void setFixedHeight()
|
||||||
{
|
{
|
||||||
if (native && native->document() &&
|
KTextBrowser *native = q->nativeWidget();
|
||||||
|
if (native->document() &&
|
||||||
q->sizePolicy().verticalPolicy() == QSizePolicy::Fixed &&
|
q->sizePolicy().verticalPolicy() == QSizePolicy::Fixed &&
|
||||||
native->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
|
native->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
|
||||||
native->document()->setTextWidth(q->size().width());
|
native->document()->setTextWidth(q->size().width());
|
||||||
@ -84,7 +84,7 @@ TextBrowser::TextBrowser(QGraphicsWidget *parent)
|
|||||||
connect(native, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
connect(native, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
||||||
connect(native, SIGNAL(textChanged()), this, SLOT(setFixedHeight()));
|
connect(native, SIGNAL(textChanged()), this, SLOT(setFixedHeight()));
|
||||||
native->setWindowIcon(QIcon());
|
native->setWindowIcon(QIcon());
|
||||||
setWidget(native);
|
d->setWidget(native);
|
||||||
d->native = native;
|
d->native = native;
|
||||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
native->setFrameShape(QFrame::NoFrame);
|
native->setFrameShape(QFrame::NoFrame);
|
||||||
@ -114,12 +114,12 @@ QString TextBrowser::text() const
|
|||||||
|
|
||||||
void TextBrowser::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy)
|
void TextBrowser::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy)
|
||||||
{
|
{
|
||||||
d->native->setHorizontalScrollBarPolicy(policy);
|
nativeWidget()->setHorizontalScrollBarPolicy(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBrowser::setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy)
|
void TextBrowser::setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy)
|
||||||
{
|
{
|
||||||
d->native->setVerticalScrollBarPolicy(policy);
|
nativeWidget()->setVerticalScrollBarPolicy(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBrowser::setStyleSheet(const QString &stylesheet)
|
void TextBrowser::setStyleSheet(const QString &stylesheet)
|
||||||
@ -173,8 +173,8 @@ void TextBrowser::resizeEvent(QGraphicsSceneResizeEvent *event)
|
|||||||
|
|
||||||
void TextBrowser::wheelEvent(QGraphicsSceneWheelEvent *event)
|
void TextBrowser::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (d->native->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff &&
|
if (nativeWidget()->verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff &&
|
||||||
d->native->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
|
nativeWidget()->horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
} else {
|
} else {
|
||||||
QGraphicsProxyWidget::wheelEvent(event);
|
QGraphicsProxyWidget::wheelEvent(event);
|
||||||
|
@ -108,7 +108,7 @@ void TextEdit::setNativeWidget(KTextEdit *nativeWidget)
|
|||||||
connect(nativeWidget, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
connect(nativeWidget, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
|
||||||
|
|
||||||
nativeWidget->setWindowIcon(QIcon());
|
nativeWidget->setWindowIcon(QIcon());
|
||||||
setWidget(nativeWidget);
|
d->setWidget(nativeWidget);
|
||||||
|
|
||||||
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
nativeWidget->setAttribute(Qt::WA_NoSystemBackground);
|
||||||
nativeWidget->setFrameShape(QFrame::NoFrame);
|
nativeWidget->setFrameShape(QFrame::NoFrame);
|
||||||
|
@ -134,22 +134,19 @@ void slideWindow(QWidget *widget, Plasma::Location location)
|
|||||||
Display *dpy = QX11Info::display();
|
Display *dpy = QX11Info::display();
|
||||||
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
|
Atom atom = XInternAtom( dpy, "_KDE_SLIDE", False );
|
||||||
QVarLengthArray<long, 2> data(2);
|
QVarLengthArray<long, 2> data(2);
|
||||||
|
data[0] = -1;
|
||||||
|
|
||||||
switch (location) {
|
switch (location) {
|
||||||
case LeftEdge:
|
case LeftEdge:
|
||||||
data[0] = widget->geometry().left();
|
|
||||||
data[1] = 0;
|
data[1] = 0;
|
||||||
break;
|
break;
|
||||||
case TopEdge:
|
case TopEdge:
|
||||||
data[0] = widget->geometry().top();
|
|
||||||
data[1] = 1;
|
data[1] = 1;
|
||||||
break;
|
break;
|
||||||
case RightEdge:
|
case RightEdge:
|
||||||
data[0] = widget->geometry().right();
|
|
||||||
data[1] = 2;
|
data[1] = 2;
|
||||||
break;
|
break;
|
||||||
case BottomEdge:
|
case BottomEdge:
|
||||||
data[0] = widget->geometry().bottom();
|
|
||||||
data[1] = 3;
|
data[1] = 3;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user