Fix media:/ kioslave handling of audio CDs

Allow separate settings for each taskbar applet
Add mouse-driven Kicker resize support
pull/2/head
Timothy Pearson 11 years ago
parent 4d3d242043
commit ce3da13236

@ -36,44 +36,55 @@
#define protected public
#include "kcmtaskbarui.h"
#undef protected
#include "taskbarsettings.h"
#include "kcmtaskbar.h"
#include "kcmtaskbar.moc"
#define GLOBAL_TASKBAR_CONFIG_FILE_NAME "ktaskbarrc"
typedef KGenericFactory<TaskbarConfig, TQWidget > TaskBarFactory;
K_EXPORT_COMPONENT_FACTORY (kcm_taskbar, TaskBarFactory("kcmtaskbar") )
TaskbarAppearance::TaskbarAppearance(TQString name,
bool drawButtons,
bool haloText,
bool showButtonOnHover)
bool showButtonOnHover,
TaskBarSettings* settingsObject)
: m_name(name),
m_drawButtons(drawButtons),
m_haloText(haloText),
m_showButtonOnHover(showButtonOnHover)
m_showButtonOnHover(showButtonOnHover),
m_settingsObject(NULL)
{
m_settingsObject = settingsObject;
if (m_settingsObject)
{
m_settingsObject->readConfig();
}
}
TaskbarAppearance::TaskbarAppearance()
: m_drawButtons(false),
m_haloText(false),
m_showButtonOnHover(true)
m_showButtonOnHover(true),
m_settingsObject(NULL)
{
}
bool TaskbarAppearance::matchesSettings() const
{
return TaskBarSettings::drawButtons() == m_drawButtons &&
TaskBarSettings::haloText() == m_haloText &&
TaskBarSettings::showButtonOnHover() == m_showButtonOnHover;
return m_settingsObject->drawButtons() == m_drawButtons &&
m_settingsObject->haloText() == m_haloText &&
m_settingsObject->showButtonOnHover() == m_showButtonOnHover;
}
void TaskbarAppearance::alterSettings() const
{
TaskBarSettings::self()->setDrawButtons(m_drawButtons);
TaskBarSettings::self()->setHaloText(m_haloText);
TaskBarSettings::self()->setShowButtonOnHover(m_showButtonOnHover);
m_settingsObject->setDrawButtons(m_drawButtons);
m_settingsObject->setHaloText(m_haloText);
m_settingsObject->setShowButtonOnHover(m_showButtonOnHover);
}
// These are the strings that are actually stored in the config file.
@ -137,17 +148,27 @@ TQStringList TaskbarConfig::i18nShowTaskStatesList()
return i18nList;
}
TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringList&)
: KCModule(TaskBarFactory::instance(), parent, name)
TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringList& args)
: KCModule(TaskBarFactory::instance(), parent, name),
m_settingsObject(NULL)
{
TQVBoxLayout *layout = new TQVBoxLayout(this, 0, KDialog::spacingHint());
m_widget = new TaskbarConfigUI(this);
layout->addWidget(m_widget);
m_configFileName = GLOBAL_TASKBAR_CONFIG_FILE_NAME;
if (args.count() > 0)
{
m_configFileName = args[0];
m_widget->globalConfigWarning->hide();
}
m_settingsObject = new TaskBarSettings(KSharedConfig::openConfig(m_configFileName));
m_settingsObject->readConfig();
// TODO: Load these from .desktop files?
m_appearances.append(TaskbarAppearance(i18n("Elegant"), false, false, true));
m_appearances.append(TaskbarAppearance(i18n("Classic"), true, false, true));
m_appearances.append(TaskbarAppearance(i18n("For Transparency"), false, true, true));
m_appearances.append(TaskbarAppearance(i18n("Elegant"), false, false, true, m_settingsObject));
m_appearances.append(TaskbarAppearance(i18n("Classic"), true, false, true, m_settingsObject));
m_appearances.append(TaskbarAppearance(i18n("For Transparency"), false, true, true, m_settingsObject));
for (TaskbarAppearance::List::const_iterator it = m_appearances.constBegin();
it != m_appearances.constEnd();
@ -158,7 +179,7 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
connect(m_widget->appearance, TQT_SIGNAL(activated(int)),
this, TQT_SLOT(appearanceChanged(int)));
addConfig(TaskBarSettings::self(), m_widget);
addConfig(m_settingsObject, m_widget);
setQuickHelp(i18n("<h1>Taskbar</h1> You can configure the taskbar here."
" This includes options such as whether or not the taskbar should show all"
@ -207,6 +228,14 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
TQTimer::singleShot(0, this, TQT_SLOT(notChanged()));
}
TaskbarConfig::~TaskbarConfig()
{
if (m_settingsObject)
{
delete m_settingsObject;
}
}
void TaskbarConfig::slotUpdateCustomColors()
{
m_widget->kcfg_ActiveTaskTextColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
@ -279,17 +308,17 @@ void TaskbarConfig::load()
KCModule::load();
slotUpdateComboBox();
updateAppearanceCombo();
m_widget->showAllScreens->setChecked(!TaskBarSettings::self()->showCurrentScreenOnly());
m_widget->showAllScreens->setChecked(!m_settingsObject->showCurrentScreenOnly());
}
void TaskbarConfig::save()
{
TaskBarSettings::self()->setShowCurrentScreenOnly(!m_widget->showAllScreens->isChecked());
m_settingsObject->setShowCurrentScreenOnly(!m_widget->showAllScreens->isChecked());
int selectedAppearance = m_widget->appearance->currentItem();
if (selectedAppearance < m_appearances.count())
{
m_appearances[selectedAppearance].alterSettings();
TaskBarSettings::self()->writeConfig();
m_settingsObject->writeConfig();
}
KCModule::save();

@ -87,7 +87,7 @@ Name[zh_CN]=任务条
Name[zh_TW]=工作列
Name[zu]=Ibha yemisebenzi
Comment=Configure the panel taskbar
Comment=Configure the selected taskbar
Comment[af]=Stel die paneel taakbalk op
Comment[ar]=إعداد شريط المهام اللوح
Comment[be]=Настаўленні панэлі заданняў

@ -24,6 +24,7 @@
#include <kcmodule.h>
class TaskbarConfigUI;
class TaskBarSettings;
class TaskbarAppearance
{
@ -34,7 +35,8 @@ class TaskbarAppearance
TaskbarAppearance(TQString name,
bool drawButtons,
bool haloText,
bool showButtonOnHover);
bool showButtonOnHover,
TaskBarSettings* settingsObject);
bool matchesSettings() const;
void alterSettings() const;
@ -45,6 +47,7 @@ class TaskbarAppearance
bool m_drawButtons;
bool m_haloText;
bool m_showButtonOnHover;
TaskBarSettings* m_settingsObject;
};
class TaskbarConfig : public KCModule
@ -54,6 +57,7 @@ class TaskbarConfig : public KCModule
public:
TaskbarConfig(TQWidget *parent = 0, const char* name = 0,
const TQStringList &list = TQStringList());
~TaskbarConfig();
public slots:
void load();
@ -76,6 +80,8 @@ private:
static const TQStringList& showTaskStatesList();
static TQStringList i18nShowTaskStatesList();
TaskbarConfigUI *m_widget;
TQString m_configFileName;
TaskBarSettings* m_settingsObject;
};
#endif

@ -462,6 +462,17 @@ By default, this option is selected and all windows are shown.</string>
</widget>
</grid>
</widget>
<widget class="TQLabel" rowspan="1" colspan="2">
<property name="name">
<cstring>globalConfigWarning</cstring>
</property>
<property name="text">
<string>NOTE: This module is currently editing the global floating taskbar configuration.&lt;br&gt;To change the configuration of a specific Kicker taskbar applet, please use the Configure Taskbar menu option.</string>
</property>
<property name="buddy" stdset="0">
<cstring>kcfg_ShowTaskStates</cstring>
</property>
</widget>
<spacer>
<property name="name">
<cstring>Spacer1</cstring>

@ -57,7 +57,7 @@ TaskbarApplet::TaskbarApplet( const TQString& configFile, Type type, int actions
{
setBackgroundOrigin( AncestorOrigin );
TQHBoxLayout* layout = new TQHBoxLayout( this );
container = new TaskBarContainer( false, this );
container = new TaskBarContainer( false, configFile, this );
container->setBackgroundOrigin( AncestorOrigin );
connect(container, TQT_SIGNAL(containerCountChanged()), this, TQT_SIGNAL(updateLayout()));
layout->addWidget( container, 1 );

@ -58,7 +58,7 @@ TaskBarExtension::TaskBarExtension(const TQString& configFile, Type type,
m_rootPixmap(0)
{
TQHBoxLayout *layout = new TQHBoxLayout(this);
m_container = new TaskBarContainer(false, this);
m_container = new TaskBarContainer(false, TQString::null, this);
m_container->setBackgroundOrigin(AncestorOrigin);
positionChange(position());
layout->addWidget(m_container);

@ -38,7 +38,7 @@ set( target kicker_core )
set( ${target}_SRCS
extensionSettings.kcfgc main.cpp kicker.cpp kicker.skel
userrectsel.cpp containerarea.cpp kmenubase.ui
userrectsel.cpp usersizesel.cpp containerarea.cpp kmenubase.ui
applethandle.cpp container_base.cpp container_button.cpp
container_applet.cpp container_extension.cpp extensionmanager.cpp
menumanager.cpp pluginmanager.cpp showdesktop.cpp

@ -46,7 +46,9 @@ BaseContainer::BaseContainer( TQPopupMenu* appletOpMenu, TQWidget* parent, const
, m_immutable(false)
, _opMnu(0)
, _appletOpMnu(appletOpMenu)
{}
{
setCursor(tqarrowCursor);
}
BaseContainer::~BaseContainer()
{

@ -61,6 +61,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "kickertip.h"
#include "pluginmanager.h"
#include "userrectsel.h"
#include "usersizesel.h"
#include "container_extension.h"
@ -178,7 +179,7 @@ void ExtensionContainer::init()
{
_userHidden = static_cast<UserHidden>(tmp);
}
if (m_extension)
{
// if we have an extension, we need to grab the extension-specific
@ -218,6 +219,8 @@ void ExtensionContainer::init()
m_settings.setIExist(true);
m_settings.writeConfig();
}
setMouseTracking(true);
}
ExtensionContainer::~ExtensionContainer()
@ -2028,6 +2031,66 @@ TQRect ExtensionContainer::initialGeometry(KPanelExtension::Position p,
return TQRect(point, size);
}
bool ExtensionContainer::inResizeArea(TQPoint mousePos) const
{
if (KickerSettings::useResizeHandle() &&
!KickerSettings::locked() &&
!Kicker::the()->isImmutable() &&
!m_settings.config()->isImmutable() &&
!ExtensionManager::the()->isMenuBar(this))
{
KPanelExtension::Position pos = position();
if (pos == KPanelExtension::Left)
{
if (mousePos.x() < (width() - PANEL_RESIZE_HANDLE_WIDTH))
{
return false;
}
else
{
return true;
}
}
else if (pos == KPanelExtension::Right)
{
if (mousePos.x() <= PANEL_RESIZE_HANDLE_WIDTH)
{
return true;
}
else
{
return false;
}
}
else if (pos == KPanelExtension::Top)
{
if (mousePos.y() < (height() - PANEL_RESIZE_HANDLE_WIDTH))
{
return false;
}
else
{
return true;
}
}
else
{
if (mousePos.y() <= PANEL_RESIZE_HANDLE_WIDTH)
{
return true;
}
else
{
return false;
}
}
}
else
{
return false;
}
}
bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
{
if (autoHidden())
@ -2066,8 +2129,27 @@ bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
TQMouseEvent* me = TQT_TQMOUSEEVENT(e);
if ( me->button() == Qt::LeftButton )
{
_last_lmb_press = me->globalPos();
_is_lmb_down = true;
if (inResizeArea(me->pos()))
{
_last_lmb_press = me->globalPos();
_is_lmb_down = true;
KPanelExtension::Position pos = position();
TQRect newRect = UserSizeSel::select(geometry(), position(), m_highlightColor);
if ((pos == KPanelExtension::Left) || (pos == KPanelExtension::Right))
{
setSize(KPanelExtension::SizeCustom, newRect.width()-((KickerSettings::useResizeHandle())?(PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE):0));
}
if ((pos == KPanelExtension::Top) || (pos == KPanelExtension::Bottom))
{
setSize(KPanelExtension::SizeCustom, newRect.height()-((KickerSettings::useResizeHandle())?(PANEL_RESIZE_HANDLE_WIDTH + PANEL_BOTTOM_SPACING_W_RESIZE_HANDLE):0));
}
}
else
{
_last_lmb_press = me->globalPos();
_is_lmb_down = true;
}
}
else if (me->button() == Qt::RightButton)
{
@ -2089,7 +2171,56 @@ bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
case TQEvent::MouseMove:
{
TQMouseEvent* me = (TQMouseEvent*) e;
TQMouseEvent* me = TQT_TQMOUSEEVENT(e);
if (KickerSettings::useResizeHandle())
{
KPanelExtension::Position pos = position();
if (pos == KPanelExtension::Left)
{
if (inResizeArea(me->pos()))
{
setCursor(sizeHorCursor);
}
else
{
setCursor(tqarrowCursor);
}
}
else if (pos == KPanelExtension::Right)
{
if (inResizeArea(me->pos()))
{
setCursor(sizeHorCursor);
}
else
{
setCursor(tqarrowCursor);
}
}
else if (pos == KPanelExtension::Top)
{
if (inResizeArea(me->pos()))
{
setCursor(tqsizeVerCursor);
}
else
{
setCursor(tqarrowCursor);
}
}
else
{
if (inResizeArea(me->pos()))
{
setCursor(tqsizeVerCursor);
}
else
{
setCursor(tqarrowCursor);
}
}
}
if (_is_lmb_down &&
((me->state() & Qt::LeftButton) == Qt::LeftButton) &&
!Kicker::the()->isImmutable() &&

@ -100,6 +100,8 @@ public:
void unhideIfHidden(int showForHowManyMS = 0);
bool reserveStrut() const;
bool inResizeArea(TQPoint mousePos) const;
KPanelExtension::Alignment alignment() const;
void setAlignment(KPanelExtension::Alignment a) { arrange( position(), a, xineramaScreen() ); }
@ -172,17 +174,17 @@ private:
bool _autoHidden;
UserHidden _userHidden;
bool _block_user_input;
TQPoint _last_lmb_press;
TQPoint _last_lmb_press;
bool _is_lmb_down;
bool _in_autohide;
// Misc objects
TQTimer *_autohideTimer;
TQTimer *_updateLayoutTimer;
TQTimer *_autohideTimer;
TQTimer *_updateLayoutTimer;
NETExtendedStrut _strut;
PopupWidgetFilter *_popupWidgetFilter;
TQString _id;
TQString _id;
PanelExtensionOpMenu *_opMnu;
AppletInfo _info;
KPanelExtension::Type _type;

@ -320,7 +320,7 @@ void Kicker::setInsertionPoint(const TQPoint &p)
}
void Kicker::showConfig(const TQString& configPath, int page)
void Kicker::showConfig(const TQString& configPath, const TQString& configFile, int page)
{
if (!m_configDialog)
{
@ -328,9 +328,27 @@ void Kicker::showConfig(const TQString& configPath, int page)
TQStringList modules = configModules(false);
TQStringList::ConstIterator end(modules.end());
int moduleNumber = 0;
for (TQStringList::ConstIterator it = modules.begin(); it != end; ++it)
{
m_configDialog->addModule(*it);
if (configFile == "")
{
m_configDialog->addModule(*it);
}
else
{
if (moduleNumber == page)
{
TQStringList argList;
argList << configFile;
m_configDialog->addModule(*it, true, argList);
}
else
{
m_configDialog->addModule(*it);
}
}
moduleNumber++;
}
connect(m_configDialog, TQT_SIGNAL(finished()), TQT_SLOT(configDialogFinished()));
@ -349,13 +367,24 @@ void Kicker::showConfig(const TQString& configPath, int page)
m_configDialog->raise();
if (page > -1)
{
m_configDialog->showPage(page);
if (configFile == "")
{
m_configDialog->showPage(0);
}
else {
m_configDialog->showPage(page);
}
}
}
void Kicker::showTaskBarConfig()
{
showConfig(TQString(), 4);
showConfig(TQString(), TQString(), 4);
}
void Kicker::showTaskBarConfig(const TQString& configFile)
{
showConfig(TQString(), configFile, 4);
}
void Kicker::configureMenubar()

@ -56,8 +56,9 @@ k_dcop:
void showKMenu();
void toggleShowDesktop();
bool desktopShowing();
void showConfig(const TQString& config, int page = -1);
void showConfig(const TQString& config, const TQString& configFile = TQString::null, int page = -1);
void showTaskBarConfig();
void showTaskBarConfig(const TQString& configFile);
void configureMenubar();
// return the region on the desktop, which is not covered by panels
// and therefore allowed to be used by icons placed on the desktop

@ -0,0 +1,235 @@
/*****************************************************************
Copyright (c) 1996-2000 the kicker authors. See file AUTHORS.
Copyright (c) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#include <tqapplication.h>
#include <tqpainter.h>
#include <tqcursor.h>
#include "usersizesel.h"
#include "usersizesel.moc"
#define PANEL_MINIMUM_HEIGHT 16
UserSizeSel::UserSizeSel(const TQRect& rect, const KPanelExtension::Position pos, const TQColor& color)
: TQWidget(0, 0, (WFlags)(WStyle_Customize | WX11BypassWM)),
_orig_size(0),
_rect(rect),
_orig_rect(rect),
_pos(pos),
_frame1_shown(false),
_frame2_shown(false)
{
if ((pos == KPanelExtension::Left) || (pos == KPanelExtension::Right))
{
setCursor(sizeHorCursor);
}
if ((pos == KPanelExtension::Top) || (pos == KPanelExtension::Bottom))
{
setCursor(tqsizeVerCursor);
}
setGeometry(-10, -10, 2, 2);
_color = color;
for (int i = 0; i < 8; i++)
{
_frame[i] = 0;
}
}
UserSizeSel::~UserSizeSel()
{
for (int i = 0; i < 8; i++)
{
delete _frame[i];
}
_frame1_shown = false;
_frame2_shown = false;
}
void UserSizeSel::mouseReleaseEvent(TQMouseEvent * e)
{
if (e->button() == Qt::LeftButton)
{
tqApp->exit_loop();
}
}
void UserSizeSel::mouseMoveEvent(TQMouseEvent * e)
{
int newSize = _orig_size;
TQPoint p(e->globalPos() - _orig_mouse_pos);
if (_pos == KPanelExtension::Left)
{
newSize = _orig_size + p.x();
}
if (_pos == KPanelExtension::Right)
{
newSize = _orig_size + ((-1)*p.x());
}
if (_pos == KPanelExtension::Top)
{
newSize = _orig_size + p.y();
}
if (_pos == KPanelExtension::Bottom)
{
newSize = _orig_size + ((-1)*p.y());
}
// int screen = xineramaScreen();
// if (screen < 0)
// {
// screen = kapp->desktop()->screenNumber(this);
// }
// TQRect desktopGeom = TQApplication::desktop()->screenGeometry(screen);
if (newSize < PANEL_MINIMUM_HEIGHT)
{
newSize = PANEL_MINIMUM_HEIGHT;
}
int maxSize = 256;
// if ((_pos == KPanelExtension::Left) || (_pos == KPanelExtension::Right))
// {
// maxSize = desktopGeom.width()/2;
// }
// if ((_pos == KPanelExtension::Top) || (_pos == KPanelExtension::Bottom))
// {
// maxSize = desktopGeom.height()/2;
// }
if (newSize > maxSize)
{
newSize = maxSize;
}
if (_pos == KPanelExtension::Left)
{
_rect.setWidth(newSize);
}
if (_pos == KPanelExtension::Right)
{
_rect.setX(_orig_rect.x()-(newSize-_orig_size));
_rect.setWidth(newSize);
}
if (_pos == KPanelExtension::Top)
{
_rect.setHeight(newSize);
}
if (_pos == KPanelExtension::Bottom)
{
_rect.setY(_orig_rect.y()-(newSize-_orig_size));
_rect.setHeight(newSize);
}
// Compress paint events to increase responsiveness
if (TQCursor::pos() == e->globalPos())
{
paintCurrent();
}
}
void UserSizeSel::paintCurrent()
{
int i;
int x, y, w, h;
if (!_frame[0])
{
for (i = 0; i < 4; i++)
{
_frame[i] = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WStyle_NoBorder | WX11BypassWM));
_frame[i]->setPaletteBackgroundColor(Qt::black);
}
for (i = 4; i < 8; i++)
{
_frame[i] = new TQWidget(0, 0, (WFlags)(WStyle_Customize | WStyle_NoBorder | WX11BypassWM));
_frame[i]->setPaletteBackgroundColor(_color);
}
}
x = _rect.x();
y = _rect.y();
w = _rect.width();
h = _rect.height();
if (w > 0 && h > 0)
{
_frame[0]->setGeometry(x, y, w, 4);
_frame[1]->setGeometry(x, y, 4, h);
_frame[2]->setGeometry(x + w - 4, y, 4, h);
_frame[3]->setGeometry(x, y + h - 4, w, 4);
if (!_frame1_shown)
{
for (i = 0; i < 4; i++)
{
_frame[i]->show();
}
_frame1_shown = true;
}
}
x += 1;
y += 1;
w -= 2;
h -= 2;
if (w > 0 && h > 0)
{
_frame[4]->setGeometry(x, y, w, 2);
_frame[5]->setGeometry(x, y, 2, h);
_frame[6]->setGeometry(x + w - 2, y, 2, h);
_frame[7]->setGeometry(x, y + h - 2, w, 2);
if (!_frame2_shown)
{
for (i = 4; i < 8; i++)
{
_frame[i]->show();
}
_frame2_shown = true;
}
}
}
TQRect UserSizeSel::select(const TQRect& rect, const KPanelExtension::Position pos, const TQColor& color)
{
UserSizeSel sel(rect, pos, color);
sel._orig_mouse_pos = TQCursor::pos();
if ((pos == KPanelExtension::Left) || (pos == KPanelExtension::Right))
{
sel._orig_size = rect.width();
}
if ((pos == KPanelExtension::Top) || (pos == KPanelExtension::Bottom))
{
sel._orig_size = rect.height();
}
sel.show();
sel.grabMouse();
sel.paintCurrent();
tqApp->enter_loop();
sel.paintCurrent();
sel.releaseMouse();
tqApp->syncX();
return sel._rect;
}

@ -0,0 +1,64 @@
/*****************************************************************
Copyright (c) 1996-2000 the kicker authors. See file AUTHORS.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#ifndef __usersizesel_h__
#define __usersizesel_h__
#include <tqwidget.h>
#include <tqvaluevector.h>
#include <tqcolor.h>
#include <kpanelextension.h>
class ShutUpCompiler;
class UserSizeSel : public TQWidget
{
Q_OBJECT
public:
static TQRect select(const TQRect& rect, const KPanelExtension::Position pos, const TQColor& color);
protected:
void mouseReleaseEvent(TQMouseEvent *);
void mouseMoveEvent(TQMouseEvent *);
private:
UserSizeSel(const TQRect& rect, const KPanelExtension::Position pos, const TQColor& color);
~UserSizeSel();
void paintCurrent();
TQPoint _orig_mouse_pos;
int _orig_size;
TQRect _rect;
TQRect _orig_rect;
KPanelExtension::Position _pos;
TQWidget *_frame[8];
TQColor _color;
bool _frame1_shown;
bool _frame2_shown;
friend class ShutUpCompiler;
};
#endif

@ -50,7 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskbar.moc"
TaskBar::TaskBar( TQWidget *parent, const char *name )
TaskBar::TaskBar( TaskBarSettings* settingsObject, TQWidget *parent, const char *name )
: Panner( parent, name ),
m_showAllWindows(false),
m_cycleWheel(false),
@ -66,7 +66,13 @@ TaskBar::TaskBar( TQWidget *parent, const char *name )
{
arrowType = LeftArrow;
blocklayout = true;
m_settingsObject = settingsObject;
if (m_settingsObject)
{
m_settingsObject->readConfig();
}
// init
setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
@ -167,8 +173,8 @@ TQSize TaskBar::sizeHint() const
// get our minimum height based on the minimum button height or the
// height of the font in use, which is largest
TQFontMetrics fm(KGlobalSettings::taskbarFont());
int minButtonHeight = fm.height() > TaskBarSettings::minimumButtonHeight() ?
fm.height() : TaskBarSettings::minimumButtonHeight();
int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
fm.height() : m_settingsObject->minimumButtonHeight();
return TQSize(BUTTON_MIN_WIDTH, minButtonHeight);
}
@ -178,8 +184,8 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
// get our minimum height based on the minimum button height or the
// height of the font in use, which is largest
TQFontMetrics fm(KGlobalSettings::taskbarFont());
int minButtonHeight = fm.height() > TaskBarSettings::minimumButtonHeight() ?
fm.height() : TaskBarSettings::minimumButtonHeight();
int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
fm.height() : m_settingsObject->minimumButtonHeight();
if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{
@ -206,7 +212,7 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
rows = 1;
}
int maxWidth = TaskBarSettings::maximumButtonWidth();
int maxWidth = m_settingsObject->maximumButtonWidth();
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@ -240,15 +246,15 @@ void TaskBar::configure()
bool wasShowOnlyIconified = m_showOnlyIconified;
int wasShowTaskStates = m_showTaskStates;
m_showAllWindows = TaskBarSettings::showAllWindows();
m_sortByDesktop = m_showAllWindows && TaskBarSettings::sortByDesktop();
m_showIcon = TaskBarSettings::showIcon();
m_showOnlyIconified = TaskBarSettings::showOnlyIconified();
m_cycleWheel = TaskBarSettings::cycleWheel();
m_showTaskStates = TaskBarSettings::showTaskStates();
m_showAllWindows = m_settingsObject->showAllWindows();
m_sortByDesktop = m_showAllWindows && m_settingsObject->sortByDesktop();
m_showIcon = m_settingsObject->showIcon();
m_showOnlyIconified = m_settingsObject->showOnlyIconified();
m_cycleWheel = m_settingsObject->cycleWheel();
m_showTaskStates = m_settingsObject->showTaskStates();
m_currentScreen = -1; // Show all screens or re-get our screen
m_showOnlyCurrentScreen = (TaskBarSettings::showCurrentScreenOnly() &&
m_showOnlyCurrentScreen = (m_settingsObject->showCurrentScreenOnly() &&
TQApplication::desktop()->isVirtualDesktop() &&
TQApplication::desktop()->numScreens() > 1) || (TQApplication::desktop()->numScreens() < 2);
@ -281,7 +287,7 @@ void TaskBar::configure()
}
}
TaskManager::the()->setXCompositeEnabled(TaskBarSettings::showThumbnails());
TaskManager::the()->setXCompositeEnabled(m_settingsObject->showThumbnails());
reLayoutEventually();
}
@ -344,7 +350,7 @@ void TaskBar::add(Task::Ptr task)
}
// create new container
TaskContainer *container = new TaskContainer(task, this, viewport());
TaskContainer *container = new TaskContainer(task, this, m_settingsObject, viewport());
m_hiddenContainers.append(container);
// even though there is a signal to listen to, we have to add this
@ -373,7 +379,7 @@ void TaskBar::add(Startup::Ptr startup)
}
// create new container
TaskContainer *container = new TaskContainer(startup, frames, this, viewport());
TaskContainer *container = new TaskContainer(startup, frames, this, m_settingsObject, viewport());
m_hiddenContainers.append(container);
connect(container, TQT_SIGNAL(showMe(TaskContainer*)), this, TQT_SLOT(showTaskContainer(TaskContainer*)));
}
@ -392,7 +398,7 @@ void TaskBar::showTaskContainer(TaskContainer* container)
}
// try to place the container after one of the same app
if (TaskBarSettings::sortByApp())
if (m_settingsObject->sortByApp())
{
TaskContainer::Iterator it = containers.begin();
for (; it != containers.end(); ++it)
@ -601,8 +607,7 @@ void TaskBar::windowChanged(Task::Ptr task)
if (!container ||
(!m_showAllWindows &&
!container->onCurrentDesktop() &&
!container->isVisibleTo(this)) ||
container->isHidden())
!container->isVisibleTo(this)))
{
return;
}
@ -706,8 +711,8 @@ void TaskBar::reLayout()
// minimum button height or the height of the font in use, whichever is
// largest
TQFontMetrics fm(KGlobalSettings::taskbarFont());
int minButtonHeight = fm.height() > TaskBarSettings::minimumButtonHeight() ?
fm.height() : TaskBarSettings::minimumButtonHeight();
int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
fm.height() : m_settingsObject->minimumButtonHeight();
// horizontal layout
if (orientation() == Qt::Horizontal)
@ -745,7 +750,7 @@ void TaskBar::reLayout()
if (mbpr > bpr)
{
bwidth = contentsRect().width() / bpr;
int maxWidth = TaskBarSettings::maximumButtonWidth();
int maxWidth = m_settingsObject->maximumButtonWidth();
if (maxWidth > 0 && bwidth > maxWidth)
{
bwidth = maxWidth;
@ -966,8 +971,8 @@ int TaskBar::taskCount() const
int TaskBar::maximumButtonsWithoutShrinking() const
{
TQFontMetrics fm(KGlobalSettings::taskbarFont());
int minButtonHeight = fm.height() > TaskBarSettings::minimumButtonHeight() ?
fm.height() : TaskBarSettings::minimumButtonHeight();
int minButtonHeight = fm.height() > m_settingsObject->minimumButtonHeight() ?
fm.height() : m_settingsObject->minimumButtonHeight();
int rows = contentsRect().height() / minButtonHeight;
if (rows < 1)
@ -977,7 +982,7 @@ int TaskBar::maximumButtonsWithoutShrinking() const
if ( orientation() == Qt::Horizontal ) {
// maxWidth of 0 means no max width, drop back to default
int maxWidth = TaskBarSettings::maximumButtonWidth();
int maxWidth = m_settingsObject->maximumButtonWidth();
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@ -995,8 +1000,8 @@ int TaskBar::maximumButtonsWithoutShrinking() const
bool TaskBar::shouldGroup() const
{
return TaskBarSettings::groupTasks() == TaskBarSettings::GroupAlways ||
(TaskBarSettings::groupTasks() == TaskBarSettings::GroupWhenFull &&
return m_settingsObject->groupTasks() == m_settingsObject->GroupAlways ||
(m_settingsObject->groupTasks() == m_settingsObject->GroupWhenFull &&
taskCount() > maximumButtonsWithoutShrinking());
}
@ -1144,7 +1149,7 @@ void TaskBar::activateNextTask(bool forward)
void TaskBar::wheelEvent(TQWheelEvent* e)
{
if(TaskBarSettings::cycleWheel()) {
if(m_settingsObject->cycleWheel()) {
if (e->delta() > 0)
{

@ -44,7 +44,7 @@ class TaskBar : public Panner
Q_OBJECT
public:
TaskBar( TQWidget *parent = 0, const char *name = 0 );
TaskBar( TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0 );
~TaskBar();
TQSize sizeHint() const;
@ -132,6 +132,7 @@ private:
bool m_ignoreUpdates;
TQTimer m_relayoutTimer;
TQImage m_blendGradient;
TaskBarSettings* m_settingsObject;
};
#endif

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="ktaskbarrc"/>
<kcfgfile arg="true"/>
<group name="General">
<entry key="ShowAllWindows" type="Bool" >

@ -42,15 +42,25 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskbarcontainer.h"
#include "taskbarcontainer.moc"
TaskBarContainer::TaskBarContainer( bool enableFrame, TQWidget *parent, const char *name )
#define GLOBAL_TASKBAR_CONFIG_FILE_NAME "ktaskbarrc"
TaskBarContainer::TaskBarContainer( bool enableFrame, TQString configFileOverride, TQWidget *parent, const char *name )
: TQFrame(parent, name),
configFile(configFileOverride),
direction( KPanelApplet::Up ),
showWindowListButton( true ),
windowListButton(0),
windowListMenu(0)
windowListMenu(0),
settingsObject(NULL)
{
if (configFile == "")
{
configFile = GLOBAL_TASKBAR_CONFIG_FILE_NAME;
}
settingsObject = new TaskBarSettings(KSharedConfig::openConfig(configFile));
setBackgroundOrigin( AncestorOrigin );
uint margin;
if ( enableFrame )
{
@ -69,7 +79,7 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQWidget *parent, const ch
layout->setMargin( margin );
// scrollable taskbar
taskBar = new TaskBar(this);
taskBar = new TaskBar(settingsObject, this);
layout->addWidget( taskBar );
connect( taskBar, TQT_SIGNAL( containerCountChanged() ), TQT_SIGNAL( containerCountChanged() ) );
@ -85,13 +95,14 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQWidget *parent, const ch
TaskBarContainer::~TaskBarContainer()
{
delete windowListMenu;
if (windowListMenu) delete windowListMenu;
if (settingsObject) delete settingsObject;
}
void TaskBarContainer::configure()
{
setFont(TaskBarSettings::taskbarFont());
showWindowListButton = TaskBarSettings::showWindowListBtn();
setFont(settingsObject->taskbarFont());
showWindowListButton = settingsObject->showWindowListBtn();
if (!showWindowListButton)
{
@ -148,7 +159,7 @@ void TaskBarContainer::configChanged()
// doesn't have to also connect to the DCOP signal (less places
// to change/fix it if/when it changes) without calling
// configure() twice on taskbar on start up
TaskBarSettings::self()->readConfig();
settingsObject->readConfig();
configure();
taskBar->configure();
@ -163,7 +174,16 @@ void TaskBarContainer::preferences()
kapp->dcopClient()->attach();
}
kapp->dcopClient()->send("kicker", "kicker", "showTaskBarConfig()", data);
if (configFile == GLOBAL_TASKBAR_CONFIG_FILE_NAME)
{
kapp->dcopClient()->send("kicker", "kicker", "showTaskBarConfig()", data);
}
else
{
TQDataStream args( data, IO_WriteOnly );
args << configFile;
kapp->dcopClient()->send("kicker", "kicker", "showTaskBarConfig(TQString)", data);
}
}
void TaskBarContainer::orientationChange(Orientation o)

@ -34,6 +34,7 @@ class TQBoxLayout;
class SimpleButton;
class KWindowListMenu;
class TaskBar;
class TaskBarSettings;
class KDE_EXPORT TaskBarContainer : public TQFrame, public DCOPObject
{
@ -41,7 +42,7 @@ class KDE_EXPORT TaskBarContainer : public TQFrame, public DCOPObject
K_DCOP
public:
TaskBarContainer( bool enableFrame, TQWidget* parent = 0, const char* name = 0 );
TaskBarContainer( bool enableFrame, TQString configFileOverride = TQString::null, TQWidget* parent = 0, const char* name = 0 );
~TaskBarContainer();
void orientationChange( Orientation );
@ -64,12 +65,14 @@ protected slots:
void reconnectWindowListButton();
private:
TQString configFile;
KPanelApplet::Direction direction;
bool showWindowListButton;
TQBoxLayout * layout;
TQBoxLayout * layout;
TaskBar * taskBar;
SimpleButton * windowListButton;
KWindowListMenu * windowListMenu;
TaskBarSettings * settingsObject;
};
#endif

@ -1,5 +1,5 @@
File=taskbar.kcfg
Singleton=true
Singleton=false
ClassName=TaskBarSettings
Mutators=true
Visibility=KDE_EXPORT

@ -112,7 +112,7 @@ bool is_process_resumable(pid_t pid) {
}
}
TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar,
TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar, TaskBarSettings* settingsObject,
TQWidget *parent, const char *name)
: TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"),
@ -129,7 +129,8 @@ TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar,
discardNextMouseEvent(false),
aboutToActivate(false),
m_mouseOver(false),
m_paintEventCompression(false)
m_paintEventCompression(false),
m_settingsObject(settingsObject)
{
init();
setAcceptDrops(true); // Always enabled to activate task during drag&drop.
@ -144,7 +145,7 @@ TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar,
}
TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
TaskBar* bar, TQWidget *parent, const char *name)
TaskBar* bar, TaskBarSettings* settingsObject, TQWidget *parent, const char *name)
: TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"),
dragSwitchTimer(0, "TaskContainer::dragSwitchTimer"),
@ -161,7 +162,8 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
discardNextMouseEvent(false),
aboutToActivate(false),
m_mouseOver(false),
m_paintEventCompression(false)
m_paintEventCompression(false),
m_settingsObject(settingsObject)
{
init();
setEnabled(false);
@ -175,6 +177,11 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
void TaskContainer::init()
{
if (m_settingsObject)
{
m_settingsObject->readConfig();
}
if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay());
setWFlags(TQt::WNoAutoErase);
@ -349,11 +356,11 @@ void TaskContainer::checkAttention(const Task::Ptr t)
void TaskContainer::attentionTimerFired()
{
assert( attentionState != -1 );
if (attentionState < TaskBarSettings::attentionBlinkIterations()*2)
if (attentionState < m_settingsObject->attentionBlinkIterations()*2)
{
++attentionState;
}
else if (TaskBarSettings::attentionBlinkIterations() < 1000)
else if (m_settingsObject->attentionBlinkIterations() < 1000)
{
attentionTimer.stop();
}
@ -564,12 +571,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQPixmap *pm((TQPixmap*)p->device());
TQPixmap pixmap; // icon
Task::Ptr task = 0;
bool iconified = !TaskBarSettings::showOnlyIconified();
bool halo = TaskBarSettings::haloText();
bool alwaysDrawButtons = TaskBarSettings::drawButtons();
bool iconified = !m_settingsObject->showOnlyIconified();
bool halo = m_settingsObject->haloText();
bool alwaysDrawButtons = m_settingsObject->drawButtons();