Darrell Anderson 11 years ago
commit 3642a26c36

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

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

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

@ -462,6 +462,17 @@ By default, this option is selected and all windows are shown.</string>
</widget> </widget>
</grid> </grid>
</widget> </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> <spacer>
<property name="name"> <property name="name">
<cstring>Spacer1</cstring> <cstring>Spacer1</cstring>

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

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

@ -38,7 +38,7 @@ set( target kicker_core )
set( ${target}_SRCS set( ${target}_SRCS
extensionSettings.kcfgc main.cpp kicker.cpp kicker.skel 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 applethandle.cpp container_base.cpp container_button.cpp
container_applet.cpp container_extension.cpp extensionmanager.cpp container_applet.cpp container_extension.cpp extensionmanager.cpp
menumanager.cpp pluginmanager.cpp showdesktop.cpp menumanager.cpp pluginmanager.cpp showdesktop.cpp

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

@ -61,6 +61,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "kickertip.h" #include "kickertip.h"
#include "pluginmanager.h" #include "pluginmanager.h"
#include "userrectsel.h" #include "userrectsel.h"
#include "usersizesel.h"
#include "container_extension.h" #include "container_extension.h"
@ -178,7 +179,7 @@ void ExtensionContainer::init()
{ {
_userHidden = static_cast<UserHidden>(tmp); _userHidden = static_cast<UserHidden>(tmp);
} }
if (m_extension) if (m_extension)
{ {
// if we have an extension, we need to grab the extension-specific // 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.setIExist(true);
m_settings.writeConfig(); m_settings.writeConfig();
} }
setMouseTracking(true);
} }
ExtensionContainer::~ExtensionContainer() ExtensionContainer::~ExtensionContainer()
@ -2028,6 +2031,66 @@ TQRect ExtensionContainer::initialGeometry(KPanelExtension::Position p,
return TQRect(point, size); 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) bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
{ {
if (autoHidden()) if (autoHidden())
@ -2066,8 +2129,27 @@ bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
TQMouseEvent* me = TQT_TQMOUSEEVENT(e); TQMouseEvent* me = TQT_TQMOUSEEVENT(e);
if ( me->button() == Qt::LeftButton ) if ( me->button() == Qt::LeftButton )
{ {
_last_lmb_press = me->globalPos(); if (inResizeArea(me->pos()))
_is_lmb_down = true; {
_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) else if (me->button() == Qt::RightButton)
{ {
@ -2089,7 +2171,56 @@ bool ExtensionContainer::eventFilter( TQObject*, TQEvent * e)
case TQEvent::MouseMove: 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 && if (_is_lmb_down &&
((me->state() & Qt::LeftButton) == Qt::LeftButton) && ((me->state() & Qt::LeftButton) == Qt::LeftButton) &&
!Kicker::the()->isImmutable() && !Kicker::the()->isImmutable() &&

@ -100,6 +100,8 @@ public:
void unhideIfHidden(int showForHowManyMS = 0); void unhideIfHidden(int showForHowManyMS = 0);
bool reserveStrut() const; bool reserveStrut() const;
bool inResizeArea(TQPoint mousePos) const;
KPanelExtension::Alignment alignment() const; KPanelExtension::Alignment alignment() const;
void setAlignment(KPanelExtension::Alignment a) { arrange( position(), a, xineramaScreen() ); } void setAlignment(KPanelExtension::Alignment a) { arrange( position(), a, xineramaScreen() ); }
@ -172,17 +174,17 @@ private:
bool _autoHidden; bool _autoHidden;
UserHidden _userHidden; UserHidden _userHidden;
bool _block_user_input; bool _block_user_input;
TQPoint _last_lmb_press; TQPoint _last_lmb_press;
bool _is_lmb_down; bool _is_lmb_down;
bool _in_autohide; bool _in_autohide;
// Misc objects // Misc objects
TQTimer *_autohideTimer; TQTimer *_autohideTimer;
TQTimer *_updateLayoutTimer; TQTimer *_updateLayoutTimer;
NETExtendedStrut _strut; NETExtendedStrut _strut;
PopupWidgetFilter *_popupWidgetFilter; PopupWidgetFilter *_popupWidgetFilter;
TQString _id; TQString _id;
PanelExtensionOpMenu *_opMnu; PanelExtensionOpMenu *_opMnu;
AppletInfo _info; AppletInfo _info;
KPanelExtension::Type _type; 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) if (!m_configDialog)
{ {
@ -328,9 +328,27 @@ void Kicker::showConfig(const TQString& configPath, int page)
TQStringList modules = configModules(false); TQStringList modules = configModules(false);
TQStringList::ConstIterator end(modules.end()); TQStringList::ConstIterator end(modules.end());
int moduleNumber = 0;
for (TQStringList::ConstIterator it = modules.begin(); it != end; ++it) 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())); connect(m_configDialog, TQT_SIGNAL(finished()), TQT_SLOT(configDialogFinished()));
@ -349,13 +367,24 @@ void Kicker::showConfig(const TQString& configPath, int page)
m_configDialog->raise(); m_configDialog->raise();
if (page > -1) if (page > -1)
{ {
m_configDialog->showPage(page); if (configFile == "")
{
m_configDialog->showPage(0);
}
else {
m_configDialog->showPage(page);
}
} }
} }
void Kicker::showTaskBarConfig() void Kicker::showTaskBarConfig()
{ {
showConfig(TQString(), 4); showConfig(TQString(), TQString(), 4);
}
void Kicker::showTaskBarConfig(const TQString& configFile)
{
showConfig(TQString(), configFile, 4);
} }
void Kicker::configureMenubar() void Kicker::configureMenubar()

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

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

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="ktaskbarrc"/> <kcfgfile arg="true"/>
<group name="General"> <group name="General">
<entry key="ShowAllWindows" type="Bool" > <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.h"
#include "taskbarcontainer.moc" #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), : TQFrame(parent, name),
configFile(configFileOverride),
direction( KPanelApplet::Up ), direction( KPanelApplet::Up ),
showWindowListButton( true ), showWindowListButton( true ),
windowListButton(0), windowListButton(0),
windowListMenu(0) windowListMenu(0),
settingsObject(NULL)
{ {
if (configFile == "")
{
configFile = GLOBAL_TASKBAR_CONFIG_FILE_NAME;
}
settingsObject = new TaskBarSettings(KSharedConfig::openConfig(configFile));
setBackgroundOrigin( AncestorOrigin ); setBackgroundOrigin( AncestorOrigin );
uint margin; uint margin;
if ( enableFrame ) if ( enableFrame )
{ {
@ -69,7 +79,7 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQWidget *parent, const ch
layout->setMargin( margin ); layout->setMargin( margin );
// scrollable taskbar // scrollable taskbar
taskBar = new TaskBar(this); taskBar = new TaskBar(settingsObject, this);
layout->addWidget( taskBar ); layout->addWidget( taskBar );
connect( taskBar, TQT_SIGNAL( containerCountChanged() ), TQT_SIGNAL( containerCountChanged() ) ); connect( taskBar, TQT_SIGNAL( containerCountChanged() ), TQT_SIGNAL( containerCountChanged() ) );
@ -85,13 +95,14 @@ TaskBarContainer::TaskBarContainer( bool enableFrame, TQWidget *parent, const ch
TaskBarContainer::~TaskBarContainer() TaskBarContainer::~TaskBarContainer()
{ {
delete windowListMenu; if (windowListMenu) delete windowListMenu;
if (settingsObject) delete settingsObject;
} }
void TaskBarContainer::configure() void TaskBarContainer::configure()
{ {
setFont(TaskBarSettings::taskbarFont()); setFont(settingsObject->taskbarFont());
showWindowListButton = TaskBarSettings::showWindowListBtn(); showWindowListButton = settingsObject->showWindowListBtn();
if (!showWindowListButton) if (!showWindowListButton)
{ {
@ -148,7 +159,7 @@ void TaskBarContainer::configChanged()
// doesn't have to also connect to the DCOP signal (less places // doesn't have to also connect to the DCOP signal (less places
// to change/fix it if/when it changes) without calling // to change/fix it if/when it changes) without calling
// configure() twice on taskbar on start up // configure() twice on taskbar on start up
TaskBarSettings::self()->readConfig(); settingsObject->readConfig();
configure(); configure();
taskBar->configure(); taskBar->configure();
@ -163,7 +174,16 @@ void TaskBarContainer::preferences()
kapp->dcopClient()->attach(); 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) void TaskBarContainer::orientationChange(Orientation o)

@ -34,6 +34,7 @@ class TQBoxLayout;
class SimpleButton; class SimpleButton;
class KWindowListMenu; class KWindowListMenu;
class TaskBar; class TaskBar;
class TaskBarSettings;
class KDE_EXPORT TaskBarContainer : public TQFrame, public DCOPObject class KDE_EXPORT TaskBarContainer : public TQFrame, public DCOPObject
{ {
@ -41,7 +42,7 @@ class KDE_EXPORT TaskBarContainer : public TQFrame, public DCOPObject
K_DCOP K_DCOP
public: 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(); ~TaskBarContainer();
void orientationChange( Orientation ); void orientationChange( Orientation );
@ -64,12 +65,14 @@ protected slots:
void reconnectWindowListButton(); void reconnectWindowListButton();
private: private:
TQString configFile;
KPanelApplet::Direction direction; KPanelApplet::Direction direction;
bool showWindowListButton; bool showWindowListButton;
TQBoxLayout * layout; TQBoxLayout * layout;
TaskBar * taskBar; TaskBar * taskBar;
SimpleButton * windowListButton; SimpleButton * windowListButton;
KWindowListMenu * windowListMenu; KWindowListMenu * windowListMenu;
TaskBarSettings * settingsObject;
}; };
#endif #endif

@ -1,5 +1,5 @@
File=taskbar.kcfg File=taskbar.kcfg
Singleton=true Singleton=false
ClassName=TaskBarSettings ClassName=TaskBarSettings
Mutators=true Mutators=true
Visibility=KDE_EXPORT 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) TQWidget *parent, const char *name)
: TQToolButton(parent, name), : TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"), animationTimer(0, "TaskContainer::animationTimer"),
@ -129,7 +129,8 @@ TaskContainer::TaskContainer(Task::Ptr task, TaskBar* bar,
discardNextMouseEvent(false), discardNextMouseEvent(false),
aboutToActivate(false), aboutToActivate(false),
m_mouseOver(false), m_mouseOver(false),
m_paintEventCompression(false) m_paintEventCompression(false),
m_settingsObject(settingsObject)
{ {
init(); init();
setAcceptDrops(true); // Always enabled to activate task during drag&drop. 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, 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), : TQToolButton(parent, name),
animationTimer(0, "TaskContainer::animationTimer"), animationTimer(0, "TaskContainer::animationTimer"),
dragSwitchTimer(0, "TaskContainer::dragSwitchTimer"), dragSwitchTimer(0, "TaskContainer::dragSwitchTimer"),
@ -161,7 +162,8 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
discardNextMouseEvent(false), discardNextMouseEvent(false),
aboutToActivate(false), aboutToActivate(false),
m_mouseOver(false), m_mouseOver(false),
m_paintEventCompression(false) m_paintEventCompression(false),
m_settingsObject(settingsObject)
{ {
init(); init();
setEnabled(false); setEnabled(false);
@ -175,6 +177,11 @@ TaskContainer::TaskContainer(Startup::Ptr startup, PixmapList& startupFrames,
void TaskContainer::init() void TaskContainer::init()
{ {
if (m_settingsObject)
{
m_settingsObject->readConfig();
}
if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay()); if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay());
setWFlags(TQt::WNoAutoErase); setWFlags(TQt::WNoAutoErase);
@ -349,11 +356,11 @@ void TaskContainer::checkAttention(const Task::Ptr t)
void TaskContainer::attentionTimerFired() void TaskContainer::attentionTimerFired()
{ {
assert( attentionState != -1 ); assert( attentionState != -1 );
if (attentionState < TaskBarSettings::attentionBlinkIterations()*2) if (attentionState < m_settingsObject->attentionBlinkIterations()*2)
{ {
++attentionState; ++attentionState;
} }
else if (TaskBarSettings::attentionBlinkIterations() < 1000) else if (m_settingsObject->attentionBlinkIterations() < 1000)
{ {
attentionTimer.stop(); attentionTimer.stop();
} }
@ -564,12 +571,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQPixmap *pm((TQPixmap*)p->device()); TQPixmap *pm((TQPixmap*)p->device());
TQPixmap pixmap; // icon TQPixmap pixmap; // icon
Task::Ptr task = 0; Task::Ptr task = 0;
bool iconified = !TaskBarSettings::showOnlyIconified(); bool iconified = !m_settingsObject->showOnlyIconified();
bool halo = TaskBarSettings::haloText(); bool halo = m_settingsObject->haloText();
bool alwaysDrawButtons = TaskBarSettings::drawButtons(); bool alwaysDrawButtons = m_settingsObject->drawButtons();
bool drawButton = alwaysDrawButtons || bool drawButton = alwaysDrawButtons ||
(m_mouseOver && !halo && isEnabled() && (m_mouseOver && !halo && isEnabled() &&
TaskBarSettings::showButtonOnHover()); m_settingsObject->showButtonOnHover());
TQFont font(KGlobalSettings::taskbarFont()); TQFont font(KGlobalSettings::taskbarFont());
// draw sunken if we contain the active task // draw sunken if we contain the active task
@ -591,7 +598,7 @@ void TaskContainer::drawButton(TQPainter *p)
if (task->demandsAttention()) if (task->demandsAttention())
{ {
demandsAttention = attentionState == TaskBarSettings::attentionBlinkIterations() || demandsAttention = attentionState == m_settingsObject->attentionBlinkIterations() ||
attentionState % 2 == 0; attentionState % 2 == 0;
} }
} }
@ -600,12 +607,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQColorGroup colors = palette().active(); TQColorGroup colors = palette().active();
if (TaskBarSettings::useCustomColors()) if (m_settingsObject->useCustomColors())
{ {
colors.setColor( TQColorGroup::Button, TaskBarSettings::taskBackgroundColor()); colors.setColor( TQColorGroup::Button, m_settingsObject->taskBackgroundColor());
colors.setColor( TQColorGroup::Background, TaskBarSettings::taskBackgroundColor() ); colors.setColor( TQColorGroup::Background, m_settingsObject->taskBackgroundColor() );
colors.setColor( TQColorGroup::ButtonText, TaskBarSettings::inactiveTaskTextColor() ); colors.setColor( TQColorGroup::ButtonText, m_settingsObject->inactiveTaskTextColor() );
colors.setColor( TQColorGroup::Text, TaskBarSettings::inactiveTaskTextColor() ); colors.setColor( TQColorGroup::Text, m_settingsObject->inactiveTaskTextColor() );
} }
if (demandsAttention) if (demandsAttention)
@ -753,9 +760,9 @@ void TaskContainer::drawButton(TQPainter *p)
} }
else // hack for the dotNET style and others else // hack for the dotNET style and others
{ {
if (TaskBarSettings::useCustomColors()) if (m_settingsObject->useCustomColors())
{ {
textPen = TQPen(TaskBarSettings::activeTaskTextColor()); textPen = TQPen(m_settingsObject->activeTaskTextColor());
} }
else else
{ {
@ -982,20 +989,20 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e )
switch (e->button()) switch (e->button())
{ {
case Qt::LeftButton: case Qt::LeftButton:
buttonAction = TaskBarSettings::action(TaskBarSettings::LeftButton); buttonAction = m_settingsObject->action(m_settingsObject->LeftButton);
break; break;
case Qt::MidButton: case Qt::MidButton:
buttonAction = TaskBarSettings::action(TaskBarSettings::MiddleButton); buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton);
break; break;
case Qt::RightButton: case Qt::RightButton:
default: default:
buttonAction = TaskBarSettings::action(TaskBarSettings::RightButton); buttonAction = m_settingsObject->action(m_settingsObject->RightButton);
break; break;
} }
if ((buttonAction == TaskBarSettings::ShowTaskList && if ((buttonAction == m_settingsObject->ShowTaskList &&
m_filteredTasks.count() > 1) || m_filteredTasks.count() > 1) ||
buttonAction == TaskBarSettings::ShowOperationsMenu) buttonAction == m_settingsObject->ShowOperationsMenu)
{ {
performAction(buttonAction); performAction(buttonAction);
} }
@ -1005,7 +1012,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
{ {
m_dragStartPos = TQPoint(); m_dragStartPos = TQPoint();
if (!TaskBarSettings::drawButtons()) if (!m_settingsObject->drawButtons())
{ {
setDown(false); setDown(false);
} }
@ -1023,20 +1030,20 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
switch (e->button()) switch (e->button())
{ {
case Qt::LeftButton: case Qt::LeftButton:
buttonAction = TaskBarSettings::action(TaskBarSettings::LeftButton); buttonAction = m_settingsObject->action(m_settingsObject->LeftButton);
break; break;
case Qt::MidButton: case Qt::MidButton:
buttonAction = TaskBarSettings::action(TaskBarSettings::MiddleButton); buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton);
break; break;
case Qt::RightButton: case Qt::RightButton:
default: default:
buttonAction = TaskBarSettings::action(TaskBarSettings::RightButton); buttonAction = m_settingsObject->action(m_settingsObject->RightButton);
break; break;
} }
if ((buttonAction == TaskBarSettings::ShowTaskList && if ((buttonAction == m_settingsObject->ShowTaskList &&
m_filteredTasks.count() > 1) || m_filteredTasks.count() > 1) ||
buttonAction == TaskBarSettings::ShowOperationsMenu) buttonAction == m_settingsObject->ShowOperationsMenu)
{ {
return; return;
} }
@ -1063,13 +1070,13 @@ void TaskContainer::performAction(int action)
// If there is only one task, the correct behavior is // If there is only one task, the correct behavior is
// to activate, raise, or iconify it, not show the task menu. // to activate, raise, or iconify it, not show the task menu.
if( m_filteredTasks.count() > 1 ) { if( m_filteredTasks.count() > 1 ) {
popupMenu( TaskBarSettings::ShowTaskList ); popupMenu( m_settingsObject->ShowTaskList );
} else { } else {
performAction( TaskBarSettings::ActivateRaiseOrMinimize ); performAction( TaskBarSettings::ActivateRaiseOrMinimize );
} }
break; break;
case TaskBarSettings::ShowOperationsMenu: case TaskBarSettings::ShowOperationsMenu:
popupMenu( TaskBarSettings::ShowOperationsMenu ); popupMenu( m_settingsObject->ShowOperationsMenu );
break; break;
case TaskBarSettings::ActivateRaiseOrMinimize: case TaskBarSettings::ActivateRaiseOrMinimize:
if (m_filteredTasks.isEmpty()) if (m_filteredTasks.isEmpty())
@ -1199,11 +1206,11 @@ bool TaskContainer::activateNextTask(bool forward, bool& forcenext)
void TaskContainer::popupMenu(int action) void TaskContainer::popupMenu(int action)
{ {
if (action == TaskBarSettings::ShowTaskList ) if (action == m_settingsObject->ShowTaskList )
{ {
m_menu = new TaskLMBMenu(m_filteredTasks); m_menu = new TaskLMBMenu(m_filteredTasks);
} }
else if (action == TaskBarSettings::ShowOperationsMenu) else if (action == m_settingsObject->ShowOperationsMenu)
{ {
if (!kapp->authorizeKAction("twin_rmb")) if (!kapp->authorizeKAction("twin_rmb"))
{ {
@ -1447,7 +1454,7 @@ void TaskContainer::dragSwitch()
} }
else else
{ {
popupMenu(TaskBarSettings::ShowTaskList); popupMenu(m_settingsObject->ShowTaskList);
} }
} }
@ -1540,7 +1547,7 @@ void TaskContainer::updateFilteredTaskList()
{ {
Task::Ptr t = *it; Task::Ptr t = *it;
if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) && if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) &&
(!TaskBarSettings::showOnlyIconified() || t->isIconified())) (!m_settingsObject->showOnlyIconified() || t->isIconified()))
{ {
pid_t pid = 0; pid_t pid = 0;
#ifdef Q_WS_X11 #ifdef Q_WS_X11
@ -1561,15 +1568,15 @@ void TaskContainer::updateFilteredTaskList()
if (pid < 0) { if (pid < 0) {
m_filteredTasks.append(t); m_filteredTasks.append(t);
} }
else if (TaskBarSettings::showTaskStates() != TaskBarSettings::ShowAll) { else if (m_settingsObject->showTaskStates() != m_settingsObject->ShowAll) {
if (is_process_resumable(pid)) { if (is_process_resumable(pid)) {
if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowAll) { if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) {
m_filteredTasks.append(t); m_filteredTasks.append(t);
} }
else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowStopped) { else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) {
m_filteredTasks.append(t); m_filteredTasks.append(t);
} }
else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowRunning) { else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) {
t->publishIconGeometry( TQRect()); t->publishIconGeometry( TQRect());
} }
else { else {
@ -1577,13 +1584,13 @@ void TaskContainer::updateFilteredTaskList()
} }
} }
else { else {
if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowAll) { if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) {
m_filteredTasks.append(t); m_filteredTasks.append(t);
} }
else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowStopped) { else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) {
t->publishIconGeometry( TQRect()); t->publishIconGeometry( TQRect());
} }
else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowRunning) { else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) {
m_filteredTasks.append(t); m_filteredTasks.append(t);
} }
else { else {
@ -1670,12 +1677,12 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
if (m_filteredTasks.count() > 0) if (m_filteredTasks.count() > 0)
{ {
if (TaskBarSettings::showThumbnails() && if (m_settingsObject->showThumbnails() &&
m_filteredTasks.count() == 1) m_filteredTasks.count() == 1)
{ {
Task::Ptr t = m_filteredTasks.first(); Task::Ptr t = m_filteredTasks.first();
pixmap = t->thumbnail(TaskBarSettings::thumbnailMaxDimension()); pixmap = t->thumbnail(m_settingsObject->thumbnailMaxDimension());
} }
if (pixmap.isNull() && tasks.count()) if (pixmap.isNull() && tasks.count())
@ -1718,7 +1725,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
} }
} }
if (TaskBarSettings::showAllWindows() && KWin::numberOfDesktops() > 1) if (m_settingsObject->showAllWindows() && KWin::numberOfDesktops() > 1)
{ {
if (desktopMap.isEmpty()) if (desktopMap.isEmpty())
{ {

@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskmanager.h" #include "taskmanager.h"
class TaskBar; class TaskBar;
class TaskBarSettings;
typedef TQValueList<TQPixmap*> PixmapList; typedef TQValueList<TQPixmap*> PixmapList;
@ -44,8 +45,8 @@ public:
typedef TQValueList<TaskContainer*> List; typedef TQValueList<TaskContainer*> List;
typedef TQValueList<TaskContainer*>::iterator Iterator; typedef TQValueList<TaskContainer*>::iterator Iterator;
TaskContainer(Task::Ptr, TaskBar*, TQWidget *parent = 0, const char *name = 0); TaskContainer(Task::Ptr, TaskBar*, TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0);
TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, TaskBarSettings* settingsObject,
TQWidget *parent = 0, const char *name = 0); TQWidget *parent = 0, const char *name = 0);
virtual ~TaskContainer(); virtual ~TaskContainer();
@ -148,7 +149,8 @@ private:
bool m_mouseOver; bool m_mouseOver;
bool m_paintEventCompression; bool m_paintEventCompression;
enum { ATTENTION_BLINK_TIMEOUT = 4 }; enum { ATTENTION_BLINK_TIMEOUT = 4 };
TQPoint m_dragStartPos; TQPoint m_dragStartPos;
TaskBarSettings* m_settingsObject;
}; };
#endif #endif

@ -496,7 +496,9 @@ void TDEBackend::setVolumeProperties(Medium* medium)
} }
if (sdevice->isDiskOfType(TDEDiskDeviceType::CDAudio)) { if (sdevice->isDiskOfType(TDEDiskDeviceType::CDAudio)) {
mimeType = "media/audiocd" + MOUNT_SUFFIX; mimeType = "media/audiocd";
medium->unmountableState("audiocd:/?device=" + sdevice->deviceNode());
diskLabel = i18n("Audio CD");
} }
if (sdevice->isDiskOfType(TDEDiskDeviceType::CDVideo)) { if (sdevice->isDiskOfType(TDEDiskDeviceType::CDVideo)) {

Loading…
Cancel
Save