[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/containments/panel
From: Sebastian Sauer <mail () dipe ! org>
Date: 2008-01-31 22:17:17
Message-ID: 1201817837.353816.28489.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 769231 by sebsauer:
add also the Custom-item.
M +18 -4 panel.cpp
M +4 -1 panel.h
--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.cpp #769230:769231
@@ -29,6 +29,7 @@
#include <KDebug>
#include <KIcon>
#include <KDialog>
+#include <KIntNumInput>
#include <plasma/corona.h>
#include <plasma/layouts/layout.h>
@@ -382,11 +383,15 @@
m_sizeCombo->addItem(i18n("Small"), QVariant(32));
m_sizeCombo->addItem(i18n("Normal"), QVariant(48));
m_sizeCombo->addItem(i18n("Large"), QVariant(64));
- //TODO add also "custom" like at KDE3?
+ m_sizeCombo->addItem(i18n("Custom"));
+ m_sizeEdit = new KIntNumInput(p);
+ m_sizeEdit->setRange(16, 256);
+ m_sizeEdit->setValue(m_size);
+ l->addWidget(m_sizeEdit, 1, 1);
l->setColumnStretch(1,1);
bool found = false;
- for (int i = 0; i < m_sizeCombo->count(); ++i) {
+ for (int i = 0; i < m_sizeCombo->count() - 1; ++i) {
if (m_sizeCombo->itemData(i).toInt() == m_size) {
m_sizeCombo->setCurrentIndex(i);
found = true;
@@ -394,8 +399,10 @@
}
}
if (! found) {
- m_sizeCombo->setCurrentIndex(m_sizeCombo->count() - 2); //TODO dont hard-code
+ m_sizeCombo->setCurrentIndex(m_sizeCombo->count() - 1);
}
+ connect(m_sizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(sizeComboChanged()));
+ sizeComboChanged();
}
m_dialog->show();
}
@@ -403,12 +410,19 @@
void Panel::applyConfig()
{
KConfigGroup cg = config();
- m_size = m_sizeCombo->itemData(m_sizeCombo->currentIndex()).toInt();
+ const int size = m_sizeCombo->itemData(m_sizeCombo->currentIndex()).toInt();
+ m_size = size > 0 ? size : m_sizeEdit->value();
cg.writeEntry("size", m_size);
updateConstraints();
}
+void Panel::sizeComboChanged()
+{
+ QVariant v = m_sizeCombo->itemData(m_sizeCombo->currentIndex());
+ m_sizeEdit->setEnabled(v.isNull());
+}
+
K_EXPORT_PLASMA_APPLET(panel, Panel)
#include "panel.moc"
--- trunk/KDE/kdebase/workspace/plasma/containments/panel/panel.h #769230:769231
@@ -21,9 +21,10 @@
#include <plasma/containment.h>
-class KDialog;
class QComboBox;
class QAction;
+class KDialog;
+class KIntNumInput;
namespace Plasma
{
@@ -49,11 +50,13 @@
private slots:
void configure();
void applyConfig();
+ void sizeComboChanged();
private:
Plasma::Svg *m_background;
QPixmap* m_cachedBackground;
KDialog* m_dialog;
QComboBox* m_sizeCombo;
+ KIntNumInput* m_sizeEdit;
QAction* m_configureAction;
bool m_drawTop : 1;
bool m_drawLeft : 1;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic