summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kcolordialog.cpp1
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/microkde/kcolordialog.cpp b/microkde/kcolordialog.cpp
index 9a76e5e..a3d8973 100644
--- a/microkde/kcolordialog.cpp
+++ b/microkde/kcolordialog.cpp
@@ -1,92 +1,93 @@
#include "kcolordialog.h"
#include <qdialog.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qslider.h>
#include <qhbox.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <kglobal.h>
QColor KColorDialog::getColor( ) const
{
QColor c ( r->value(), g->value(), b->value() );
lar->setText ( "R: " + QString::number ( c.red() ) );
lag->setText ( "G: " + QString::number ( c.green() ) );
lab->setText ( "B: " + QString::number ( c.blue() ) );
return c;
}
void KColorDialog::setColor( const QColor & d )
{
r->setValue(d.red() );
g->setValue(d.green() );
b->setValue(d.blue() );
old_color->setPalette( QPalette( d.dark(), d ) );
lar->setText ( "R: " + QString::number ( d.red() ) );
lag->setText ( "G: " + QString::number ( d.green() ) );
lab->setText ( "B: " + QString::number ( d.blue() ) );
}
KColorDialog::KColorDialog( QWidget *p ):QDialog( p, "input-dialog", true )
{
setCaption( i18n("Choose Color") );
setMaximumSize( QApplication::desktop()->width() - 20, QApplication::desktop()->height() - 40 ); // for zaurus 5500er.
QGridLayout* lay = new QGridLayout ( this, 4, 2 );
lay->setSpacing( 6 );
lay->setMargin( 11 );
old_color = new QLabel("Old color",this);
old_color->setFrameStyle( QFrame::Panel | QFrame::Plain );
old_color->setLineWidth( 1 );
lay->addWidget(old_color, 0, 0);
new_color = new QLabel("New color", this);
new_color->setFrameStyle( QFrame::Panel | QFrame::Plain );
new_color->setLineWidth( 1 );
lay->addWidget(new_color, 0, 1);
new_color->setAlignment( AlignCenter );
QHBox* hb = new QHBox ( this );
lar = new QLabel( hb );
lag = new QLabel( hb );
lab = new QLabel( hb );
lay->addMultiCellWidget( hb,1,1, 0,1 );
QLabel* lr = new QLabel ( "Red:", this );
lay->addWidget( lr,2,0 );
r = new QSlider ( 0, 255, 1, 1, Horizontal, this );
lay->addWidget(r ,2,1 );
QLabel* lg = new QLabel( "Green:",this );
lay->addWidget(lg ,3,0 );
g = new QSlider ( 0, 255, 1, 1, Horizontal, this );
lay->addWidget( g ,3,1 );
QLabel* lb = new QLabel ( "Blue:",this );
lay->addWidget( lb,4,0 );
b = new QSlider ( 0, 255, 1, 1, Horizontal, this );
lay->addWidget(b ,4,1 );
QColor d = backgroundColor();
r->setValue(d.red() );
g->setValue(d.green() );
b->setValue(d.blue() );
old_color->setPalette( QPalette( d.dark() , d ) );
// kannst du wieder reinnehmen, aber es geht auch so.
QPushButton * ok = new QPushButton (i18n(" OK "), this );
+ ok->setDefault( true );
QPushButton * cancel = new QPushButton (i18n(" Cancel "), this );
lay->addWidget(ok ,5,0 );
lay->addWidget(cancel ,5,1 );
connect (ok, SIGNAL( clicked() ), this ,SLOT (accept() ));
connect (cancel, SIGNAL( clicked() ), this ,SLOT (reject() ));
connect (r, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
connect (g, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
connect (b, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) ));
}
void KColorDialog::updateColor( int )
{
QColor c = getColor( ) ;
new_color->setPalette( QPalette( c.dark(), c ) );
}
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 35d4916..36ede81 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1068,192 +1068,193 @@ void KToolBar::setFlat (bool flag)
/*US
if ( mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
int KToolBar::count() const
{
return id2widget.count();
}
void KToolBar::saveState()
{
/*US
// first, try to save to the xml file
if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
// go down one level to get to the right tags
QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement();
elem = elem.firstChild().toElement();
QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
QDomElement current;
// now try to find our toolbar
d->modified = false;
for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
current = elem;
if ( current.tagName().lower() != "toolbar" )
continue;
QString curname(current.attribute( "name" ));
if ( curname == barname ) {
saveState( current );
break;
}
}
// if we didn't make changes, then just return
if ( !d->modified )
return;
// now we load in the (non-merged) local file
QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance()));
QDomDocument local;
local.setContent(local_xml);
// make sure we don't append if this toolbar already exists locally
bool just_append = true;
elem = local.documentElement().toElement();
KXMLGUIFactory::removeDOMComments( elem );
elem = elem.firstChild().toElement();
for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) {
if ( elem.tagName().lower() != "toolbar" )
continue;
QString curname(elem.attribute( "name" ));
if ( curname == barname ) {
just_append = false;
local.documentElement().replaceChild( current, elem );
break;
}
}
if (just_append)
local.documentElement().appendChild( current );
KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() );
return;
}
*/
// if that didn't work, we save to the config file
KConfig *config = KGlobal::config();
saveSettings(config, QString::null);
config->sync();
}
QString KToolBar::settingsGroup()
{
QString configGroup;
if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar"))
configGroup = "Toolbar style";
else
configGroup = QString(name()) + " Toolbar style";
if ( this->mainWindow() )
{
configGroup.prepend(" ");
configGroup.prepend( this->mainWindow()->name() );
}
return configGroup;
}
void KToolBar::saveSettings(KConfig *config, const QString &_configGroup)
{
+ return;
QString configGroup = _configGroup;
if (configGroup.isEmpty())
configGroup = settingsGroup();
//kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl;
QString position, icontext;
int index;
getAttributes( position, icontext, index );
//kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl;
KConfigGroupSaver saver(config, configGroup);
if ( position != d->PositionDefault )
config->writeEntry("Position", position);
else
config->deleteEntry("Position");
if ( icontext != d->IconTextDefault )
config->writeEntry("IconText", icontext);
else
config->deleteEntry("IconText");
if ( iconSize() != d->IconSizeDefault )
config->writeEntry("IconSize", iconSize());
else
config->deleteEntry("IconSize");
if ( isHidden() != d->HiddenDefault )
config->writeEntry("Hidden", isHidden());
else
config->deleteEntry("Hidden");
if ( index != d->IndexDefault )
config->writeEntry( "Index", index );
else
config->deleteEntry("Index");
//US the older version of KDE (used on the Zaurus) has no Offset property
/* if ( offset() != d->OffsetDefault )
config->writeEntry( "Offset", offset() );
else
*/
config->deleteEntry("Offset");
//US the older version of KDE (used on the Zaurus) has no NewLine property
/*
if ( newLine() != d->NewLineDefault )
config->writeEntry( "NewLine", newLine() );
else
*/
config->deleteEntry("NewLine");
}
void KToolBar::setXMLGUIClient( KXMLGUIClient *client )
{
d->m_xmlguiClient = client;
}
void KToolBar::setText( const QString & txt )
{
//US setLabel( txt + " ( " + kapp->caption() + " ) " );
setLabel( txt + " ( " + KGlobal::getAppName() + " ) " );
}
QString KToolBar::text() const
{
return label();
}
void KToolBar::doConnections( KToolBarButton *button )
{
connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) );
connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) );
connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) );
connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) );
connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) );
connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) );
}
void KToolBar::mousePressEvent ( QMouseEvent *m )
{
if ( !mainWindow() )
return;
QMainWindow *mw = mainWindow();
if ( mw->toolBarsMovable() && d->m_enableContext ) {
if ( m->button() == RightButton ) {
int i = contextMenu()->exec( m->globalPos(), 0 );
switch ( i ) {
case -1:
return; // popup cancelled
case CONTEXT_LEFT:
//US mw->moveDockWindow( this, DockLeft );
mw->moveToolBar( this, QMainWindow::Left );
break;
@@ -1511,192 +1512,193 @@ QSize KToolBar::minimumSize() const
QSize KToolBar::minimumSizeHint() const
{
return sizeHint();
}
bool KToolBar::highlight() const
{
return d->m_highlight;
}
void KToolBar::hide()
{
QToolBar::hide();
}
void KToolBar::show()
{
QToolBar::show();
}
void KToolBar::resizeEvent( QResizeEvent *e )
{
bool b = isUpdatesEnabled();
setUpdatesEnabled( FALSE );
QToolBar::resizeEvent( e );
if (b)
d->repaintTimer.start( 100, true );
}
void KToolBar::slotIconChanged(int group)
{
if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
return;
if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
return;
emit modechange();
if (isVisible())
updateGeometry();
}
void KToolBar::slotReadConfig()
{
//kdDebug(220) << "KToolBar::slotReadConfig" << endl;
// Read appearance settings (hmm, we used to do both here,
// but a well behaved application will call applyMainWindowSettings
// anyway, right ?)
applyAppearanceSettings(KGlobal::config(), QString::null );
}
void KToolBar::slotAppearanceChanged()
{
// Read appearance settings from global file.
applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ );
// And remember to save the new look later
/*US
if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
//static
bool KToolBar::highlightSetting()
{
QString grpToolbar(QString::fromLatin1("Toolbar style"));
KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true);
}
//static
bool KToolBar::transparentSetting()
{
QString grpToolbar(QString::fromLatin1("Toolbar style"));
KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true);
}
//static
KToolBar::IconText KToolBar::iconTextSetting()
{
QString grpToolbar(QString::fromLatin1("Toolbar style"));
KConfigGroupSaver saver(KGlobal::config(), grpToolbar);
QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly"));
if ( icontext == "IconTextRight" )
return IconTextRight;
else if ( icontext == "IconTextBottom" )
return IconTextBottom;
else if ( icontext == "TextOnly" )
return TextOnly;
else
return IconOnly;
}
void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal)
{
+ return;
QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
//kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl;
// We have application-specific settings in the XML file,
// and nothing in the application's config file
// -> don't apply the global defaults, the XML ones are preferred
// See applySettings for a full explanation
/*US :we do not support xml files
if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() &&
!config->hasGroup(configGroup) )
{
//kdDebug(220) << "skipping global defaults, using XML ones instead" << endl;
return;
}
*/
if ( !config->hasGroup(configGroup) )
{
//kdDebug(220) << "skipping global defaults, using XML ones instead" << endl;
return;
}
KConfig *gconfig = KGlobal::config();
/*US
static const QString &attrIconText = KGlobal::staticQString("IconText");
static const QString &attrHighlight = KGlobal::staticQString("Highlighting");
static const QString &attrTrans = KGlobal::staticQString("TransparentMoving");
static const QString &attrSize = KGlobal::staticQString("IconSize");
*/
// we actually do this in two steps.
// First, we read in the global styles [Toolbar style] (from the KControl module).
// Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style]
bool highlight;
int transparent;
QString icontext;
int iconsize = 0;
// this is the first iteration
QString grpToolbar(QString::fromLatin1("Toolbar style"));
{ // start block for KConfigGroupSaver
KConfigGroupSaver saver(gconfig, grpToolbar);
// first, get the generic settings
//US highlight = gconfig->readBoolEntry(attrHighlight, true);
highlight = gconfig->readBoolEntry("Highlighting", true);
//US transparent = gconfig->readBoolEntry(attrTrans, true);
transparent = gconfig->readBoolEntry("TransparentMoving", true);
// we read in the IconText property *only* if we intend on actually
// honoring it
if (d->m_honorStyle)
//US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault);
d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault);
else
d->IconTextDefault = "IconOnly";
// Use the default icon size for toolbar icons.
//US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault);
d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault);
if ( !forceGlobal && config->hasGroup(configGroup) )
{
config->setGroup(configGroup);
// first, get the generic settings
//US highlight = config->readBoolEntry(attrHighlight, highlight);
highlight = config->readBoolEntry("Highlighting", highlight);
//US transparent = config->readBoolEntry(attrTrans, transparent);
transparent = config->readBoolEntry("TransparentMoving", transparent);
// now we always read in the IconText property
//US icontext = config->readEntry(attrIconText, d->IconTextDefault);
icontext = config->readEntry("IconText", d->IconTextDefault);
// now get the size
//US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault);
iconsize = config->readNumEntry("IconSize", d->IconSizeDefault);
}
else
{
iconsize = d->IconSizeDefault;
icontext = d->IconTextDefault;
}
// revert back to the old group
} // end block for KConfigGroupSaver
bool doUpdate = false;
IconText icon_text;
if ( icontext == "IconTextRight" )
icon_text = IconTextRight;
else if ( icontext == "IconTextBottom" )
icon_text = IconTextBottom;
else if ( icontext == "TextOnly" )
icon_text = TextOnly;
else
icon_text = IconOnly;