diff --git a/plasma/shells/plasma-desktop/CMakeLists.txt b/plasma/shells/plasma-desktop/CMakeLists.txt index 1b929805..069c1e17 100644 --- a/plasma/shells/plasma-desktop/CMakeLists.txt +++ b/plasma/shells/plasma-desktop/CMakeLists.txt @@ -7,7 +7,6 @@ include_directories( set(plasma_SRCS scripting/desktopscriptengine.cpp scripting/panel.cpp - checkbox.cpp controllerwindow.cpp desktopcorona.cpp desktopview.cpp @@ -20,7 +19,6 @@ set(plasma_SRCS panelappletoverlay.cpp plasmaapp.cpp positioningruler.cpp - klistconfirmationdialog.cpp ) set(plasmaapp_dbusXML dbus/org.kde.plasma.App.xml) diff --git a/plasma/shells/plasma-desktop/checkbox.cpp b/plasma/shells/plasma-desktop/checkbox.cpp deleted file mode 100644 index 865a3371..00000000 --- a/plasma/shells/plasma-desktop/checkbox.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2009 Alain Boyer - * - * This program 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, or - * (at your option) any later version. - * - * This program 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 General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "checkbox.h" - -// Qt -#include - -// Plasma -#include - -CheckBox::CheckBox(QWidget *parent) - : QCheckBox(parent), - m_styleOptionButton(), - m_initialized(false) -{ - connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateStyle())); -} - -void CheckBox::updateStyle() -{ - initStyleOption(&m_styleOptionButton); - m_styleOptionButton.palette.setColor(QPalette::WindowText, Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor)); -} - -void CheckBox::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event) - QPainter painter(this); - if (!m_initialized) { - updateStyle(); - } - style()->drawControl(QStyle::CE_CheckBox, &m_styleOptionButton, &painter, this); -} - -#include "moc_checkbox.cpp" diff --git a/plasma/shells/plasma-desktop/checkbox.h b/plasma/shells/plasma-desktop/checkbox.h deleted file mode 100644 index 4ea4d80f..00000000 --- a/plasma/shells/plasma-desktop/checkbox.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2009 Alain Boyer - * - * This program 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, or - * (at your option) any later version. - * - * This program 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 General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef CHECKBOX_H -#define CHECKBOX_H - -#include -#include - -class CheckBox: public QCheckBox -{ - Q_OBJECT - -public: - CheckBox(QWidget *parent); - -public slots: - void updateStyle(); - -protected: - void paintEvent(QPaintEvent *event); - -private: - QStyleOptionButton m_styleOptionButton; - bool m_initialized; - -}; - -#endif diff --git a/plasma/shells/plasma-desktop/klistconfirmationdialog.cpp b/plasma/shells/plasma-desktop/klistconfirmationdialog.cpp deleted file mode 100644 index 1031fed9..00000000 --- a/plasma/shells/plasma-desktop/klistconfirmationdialog.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2010 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * This program 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 General Public License for more details - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "klistconfirmationdialog.h" - -#include -#include -#include -#include -#include -#include - -#include - -class KListConfirmationDialogPrivate { -public: - QVBoxLayout * mainLayout; - QHBoxLayout * buttonsLayout; - - QPushButton * buttonConfirm; - QPushButton * buttonCancel; - - QListWidget * listItems; - QLabel * labelCaption; - int iconSize; -}; - -class KListConfirmationDialogListDelegate: public QStyledItemDelegate { -public: - KListConfirmationDialogListDelegate(int iconSize) - : m_iconSize(iconSize) - { - } - - virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const - { - QStyleOptionViewItem o = option; - o.decorationSize = QSize(m_iconSize, m_iconSize); - QStyledItemDelegate::paint(painter, o, index); - } - -private: - int m_iconSize; - -}; - -KListConfirmationDialog::KListConfirmationDialog( - const QString & title, const QString & message, - const QString & confirm, const QString & cancel, - QWidget * parent, Qt::WindowFlags f) - : d(new KListConfirmationDialogPrivate()) -{ - setWindowTitle(title); - - d->mainLayout = new QVBoxLayout(this); - - d->mainLayout->addWidget(d->labelCaption = new QLabel(message, this)); - d->mainLayout->addWidget(d->listItems = new QListWidget(this)); - d->mainLayout->addLayout(d->buttonsLayout = new QHBoxLayout()); - d->buttonsLayout->addStretch(1); - - d->buttonsLayout->setContentsMargins(0, 0, 0, 0); - d->mainLayout->setContentsMargins(0, 0, 0, 0); - - d->labelCaption->setWordWrap(true); - d->labelCaption->setContentsMargins(8, 8, 8, 8); - - d->buttonsLayout->addWidget(d->buttonConfirm = new QPushButton("blah")); - d->buttonsLayout->addWidget(d->buttonCancel = new QPushButton("blah")); - - d->buttonConfirm->setText(confirm); - d->buttonCancel->setText(cancel); - - d->iconSize = KIconLoader::global()->currentSize(KIconLoader::Dialog); - - if (d->iconSize < 16) d->iconSize = KIconLoader::SizeMedium; - - d->listItems->setItemDelegate(new KListConfirmationDialogListDelegate(d->iconSize)); - - setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); - - connect(d->buttonConfirm, SIGNAL(clicked()), - this, SLOT(confirm())); - connect(d->buttonCancel, SIGNAL(clicked()), - this, SLOT(cancel())); -} - -KListConfirmationDialog::~KListConfirmationDialog() -{ - delete d; -} - -void KListConfirmationDialog::addItem(const KIcon & icon, const QString & title, - const QString & description, const QVariant & data, bool preselect) -{ - QListWidgetItem * item = new QListWidgetItem(icon, title + (description.isNull() ? QString() : "\n" + description), d->listItems); - item->setCheckState(preselect ? Qt::Checked : Qt::Unchecked); - item->setSizeHint(QSize(d->iconSize * 3/2, d->iconSize * 3/2)); - item->setData(Qt::UserRole, description); - item->setData(Qt::UserRole + 1, data); - d->listItems->addItem(item); -} - -void KListConfirmationDialog::showEvent(QShowEvent * event) -{ - // we want to update the size - int count = d->listItems->count(); - - if (count > 5) count = 5; - - resize(size().width(), - count * d->iconSize * 3 / 2 // height for the list - + d->buttonsLayout->sizeHint().height() // height for the buttons - + d->labelCaption->sizeHint().height() // height for the label - + 32); - - // if (count == d->listItems->count()) { - // d->listItems->setStyleSheet("QListWidget { border-left: none; }"); - // } -} - -void KListConfirmationDialog::show() -{ -} - -void KListConfirmationDialog::exec() -{ - QDialog::show(); -} - -void KListConfirmationDialog::confirm() -{ - QList < QVariant > result; - - foreach (QListWidgetItem * item, d->listItems->selectedItems()) { - result << item->data(Qt::UserRole + 1); - } - - selected(result); - deleteLater(); -} - -void KListConfirmationDialog::cancel() -{ - QList < QVariant > result; - selected(result); - deleteLater(); -} - diff --git a/plasma/shells/plasma-desktop/klistconfirmationdialog.h b/plasma/shells/plasma-desktop/klistconfirmationdialog.h deleted file mode 100644 index 3d2aab1b..00000000 --- a/plasma/shells/plasma-desktop/klistconfirmationdialog.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 Ivan Cukic - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * This program 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 General Public License for more details - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KLISTCONFIRMATIONDIALOG_H -#define KLISTCONFIRMATIONDIALOG_H - -class KListConfirmationDialogPrivate; - -#include -#include - -#include - -/** - * - */ -class KListConfirmationDialog: public QDialog { - Q_OBJECT - -public: - KListConfirmationDialog( - const QString & title = QString(), - const QString & message = QString(), - const QString & confirm = QString(), - const QString & cancel = QString(), - QWidget * parent = 0, Qt::WindowFlags f = 0); - virtual ~KListConfirmationDialog(); - - void addItem(const KIcon & icon, const QString & title, - const QString & description, const QVariant & data, bool preselect = false); - - - void exec(); - -protected: - void showEvent(QShowEvent * event); - -protected Q_SLOTS: - void confirm(); - void cancel(); - -Q_SIGNALS: - void selected(QList < QVariant > items); - -private: - void show(); - - class KListConfirmationDialogPrivate * const d; -}; - -#endif // KLISTCONFIRMATIONDIALOG_H diff --git a/plasma/shells/plasma-desktop/plasmaapp.cpp b/plasma/shells/plasma-desktop/plasmaapp.cpp index 39ffc204..2a473516 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.cpp +++ b/plasma/shells/plasma-desktop/plasmaapp.cpp @@ -54,14 +54,12 @@ #include "appadaptor.h" #include "controllerwindow.h" -#include "checkbox.h" #include "desktopcorona.h" #include "desktopview.h" #include "interactiveconsole.h" #include "panelshadows.h" #include "panelview.h" #include "toolbutton.h" -#include "klistconfirmationdialog.h" #ifdef Q_WS_X11 #include