diff options
author | Darrell Anderson <[email protected]> | 2013-01-06 15:44:22 -0600 |
---|---|---|
committer | Darrell Anderson <[email protected]> | 2013-01-06 15:44:22 -0600 |
commit | 3642a26c369228341bc7abf55341eb1d6d4d6dfa (patch) | |
tree | 1ab102939f160e204c237f19af47e362ad31785b | |
parent | 39c9f76c1b1bf4d2db41a217c301d1f260332697 (diff) | |
parent | ce3da132361e281919a222a519ff9901c8d6c3e1 (diff) | |
download | tdebase-3642a26c369228341bc7abf55341eb1d6d4d6dfa.tar.gz tdebase-3642a26c369228341bc7abf55341eb1d6d4d6dfa.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdebase
23 files changed, 679 insertions, 129 deletions
diff --git a/kcontrol/taskbar/kcmtaskbar.cpp b/kcontrol/taskbar/kcmtaskbar.cpp index cd1c67a1d..25f2c778d 100644 --- a/kcontrol/taskbar/kcmtaskbar.cpp +++ b/kcontrol/taskbar/kcmtaskbar.cpp @@ -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(); diff --git a/kcontrol/taskbar/kcmtaskbar.desktop b/kcontrol/taskbar/kcmtaskbar.desktop index fe5942dab..204b2e4ec 100644 --- a/kcontrol/taskbar/kcmtaskbar.desktop +++ b/kcontrol/taskbar/kcmtaskbar.desktop @@ -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]=Настаўленні панэлі заданняў diff --git a/kcontrol/taskbar/kcmtaskbar.h b/kcontrol/taskbar/kcmtaskbar.h index d41f5e6f0..5e7d9d905 100644 --- a/kcontrol/taskbar/kcmtaskbar.h +++ b/kcontrol/taskbar/kcmtaskbar.h @@ -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 diff --git a/kcontrol/taskbar/kcmtaskbarui.ui b/kcontrol/taskbar/kcmtaskbarui.ui index dd0aadb9d..6a43b5fbb 100644 --- a/kcontrol/taskbar/kcmtaskbarui.ui +++ b/kcontrol/taskbar/kcmtaskbarui.ui @@ -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.<br>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> diff --git a/kicker/applets/taskbar/taskbarapplet.cpp b/kicker/applets/taskbar/taskbarapplet.cpp index d317e1cb4..083a7e597 100644 --- a/kicker/applets/taskbar/taskbarapplet.cpp +++ b/kicker/applets/taskbar/taskbarapplet.cpp @@ -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 ); diff --git a/kicker/extensions/taskbar/taskbarextension.cpp b/kicker/extensions/taskbar/taskbarextension.cpp index 1394823e3..047dc2beb 100644 --- a/kicker/extensions/taskbar/taskbarextension.cpp +++ b/kicker/extensions/taskbar/taskbarextension.cpp @@ -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); diff --git a/kicker/kicker/core/CMakeLists.txt b/kicker/kicker/core/CMakeLists.txt index a18de2393..4db8c69d9 100644 --- a/kicker/kicker/core/CMakeLists.txt +++ b/kicker/kicker/core/CMakeLists.txt @@ -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 diff --git a/kicker/kicker/core/container_base.cpp b/kicker/kicker/core/container_base.cpp index 183ceb0f2..c42387173 100644 --- a/kicker/kicker/core/container_base.cpp +++ b/kicker/kicker/core/container_base.cpp @@ -46,7 +46,9 @@ BaseContainer::BaseContainer( TQPopupMenu* appletOpMenu, TQWidget* parent, const , m_immutable(false) , _opMnu(0) , _appletOpMnu(appletOpMenu) -{} +{ + setCursor(tqarrowCursor); +} BaseContainer::~BaseContainer() { diff --git a/kicker/kicker/core/container_extension.cpp b/kicker/kicker/core/container_extension.cpp index 87ed34267..80ceb6e13 100644 --- a/kicker/kicker/core/container_extension.cpp +++ b/kicker/kicker/core/container_extension.cpp @@ -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() && diff --git a/kicker/kicker/core/container_extension.h b/kicker/kicker/core/container_extension.h index 724ba0a10..81752bffa 100644 --- a/kicker/kicker/core/container_extension.h +++ b/kicker/kicker/core/container_extension.h @@ -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; diff --git a/kicker/kicker/core/kicker.cpp b/kicker/kicker/core/kicker.cpp index 4c433aa8e..7410d4877 100644 --- a/kicker/kicker/core/kicker.cpp +++ b/kicker/kicker/core/kicker.cpp @@ -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() diff --git a/kicker/kicker/core/kicker.h b/kicker/kicker/core/kicker.h index bc00e1915..0416bc5ce 100644 --- a/kicker/kicker/core/kicker.h +++ b/kicker/kicker/core/kicker.h @@ -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 diff --git a/kicker/kicker/core/usersizesel.cpp b/kicker/kicker/core/usersizesel.cpp new file mode 100644 index 000000000..107a2527a --- /dev/null +++ b/kicker/kicker/core/usersizesel.cpp @@ -0,0 +1,235 @@ +/***************************************************************** + +Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. +Copyright (c) 2012 Timothy Pearson <[email protected]> + +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; +} + diff --git a/kicker/kicker/core/usersizesel.h b/kicker/kicker/core/usersizesel.h new file mode 100644 index 000000000..64c8950bd --- /dev/null +++ b/kicker/kicker/core/usersizesel.h @@ -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 diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp index dd66c22b2..fdb7e0ebf 100644 --- a/kicker/taskbar/taskbar.cpp +++ b/kicker/taskbar/taskbar.cpp @@ -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) { diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h index dc75fab9c..78f95844c 100644 --- a/kicker/taskbar/taskbar.h +++ b/kicker/taskbar/taskbar.h @@ -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 diff --git a/kicker/taskbar/taskbar.kcfg b/kicker/taskbar/taskbar.kcfg index 1ac6dadbf..7d8d1f5d9 100644 --- a/kicker/taskbar/taskbar.kcfg +++ b/kicker/taskbar/taskbar.kcfg @@ -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" > diff --git a/kicker/taskbar/taskbarcontainer.cpp b/kicker/taskbar/taskbarcontainer.cpp index 938487dfc..00ed9786c 100644 --- a/kicker/taskbar/taskbarcontainer.cpp +++ b/kicker/taskbar/taskbarcontainer.cpp @@ -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) diff --git a/kicker/taskbar/taskbarcontainer.h b/kicker/taskbar/taskbarcontainer.h index 87a55c2b9..cac8f1f2d 100644 --- a/kicker/taskbar/taskbarcontainer.h +++ b/kicker/taskbar/taskbarcontainer.h @@ -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 diff --git a/kicker/taskbar/taskbarsettings.kcfgc b/kicker/taskbar/taskbarsettings.kcfgc index 45c0da407..c5219f64e 100644 --- a/kicker/taskbar/taskbarsettings.kcfgc +++ b/kicker/taskbar/taskbarsettings.kcfgc @@ -1,5 +1,5 @@ File=taskbar.kcfg -Singleton=true +Singleton=false ClassName=TaskBarSettings Mutators=true Visibility=KDE_EXPORT diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp index 79aca98e8..600bac7e9 100644 --- a/kicker/taskbar/taskcontainer.cpp +++ b/kicker/taskbar/taskcontainer.cpp @@ -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(); bool drawButton = alwaysDrawButtons || (m_mouseOver && !halo && isEnabled() && - TaskBarSettings::showButtonOnHover()); + m_settingsObject->showButtonOnHover()); TQFont font(KGlobalSettings::taskbarFont()); // draw sunken if we contain the active task @@ -591,7 +598,7 @@ void TaskContainer::drawButton(TQPainter *p) if (task->demandsAttention()) { - demandsAttention = attentionState == TaskBarSettings::attentionBlinkIterations() || + demandsAttention = attentionState == m_settingsObject->attentionBlinkIterations() || attentionState % 2 == 0; } } @@ -600,12 +607,12 @@ void TaskContainer::drawButton(TQPainter *p) TQColorGroup colors = palette().active(); - if (TaskBarSettings::useCustomColors()) + if (m_settingsObject->useCustomColors()) { - colors.setColor( TQColorGroup::Button, TaskBarSettings::taskBackgroundColor()); - colors.setColor( TQColorGroup::Background, TaskBarSettings::taskBackgroundColor() ); - colors.setColor( TQColorGroup::ButtonText, TaskBarSettings::inactiveTaskTextColor() ); - colors.setColor( TQColorGroup::Text, TaskBarSettings::inactiveTaskTextColor() ); + colors.setColor( TQColorGroup::Button, m_settingsObject->taskBackgroundColor()); + colors.setColor( TQColorGroup::Background, m_settingsObject->taskBackgroundColor() ); + colors.setColor( TQColorGroup::ButtonText, m_settingsObject->inactiveTaskTextColor() ); + colors.setColor( TQColorGroup::Text, m_settingsObject->inactiveTaskTextColor() ); } if (demandsAttention) @@ -753,9 +760,9 @@ void TaskContainer::drawButton(TQPainter *p) } 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 { @@ -982,20 +989,20 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e ) switch (e->button()) { case Qt::LeftButton: - buttonAction = TaskBarSettings::action(TaskBarSettings::LeftButton); + buttonAction = m_settingsObject->action(m_settingsObject->LeftButton); break; case Qt::MidButton: - buttonAction = TaskBarSettings::action(TaskBarSettings::MiddleButton); + buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton); break; case Qt::RightButton: default: - buttonAction = TaskBarSettings::action(TaskBarSettings::RightButton); + buttonAction = m_settingsObject->action(m_settingsObject->RightButton); break; } - if ((buttonAction == TaskBarSettings::ShowTaskList && + if ((buttonAction == m_settingsObject->ShowTaskList && m_filteredTasks.count() > 1) || - buttonAction == TaskBarSettings::ShowOperationsMenu) + buttonAction == m_settingsObject->ShowOperationsMenu) { performAction(buttonAction); } @@ -1005,7 +1012,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e) { m_dragStartPos = TQPoint(); - if (!TaskBarSettings::drawButtons()) + if (!m_settingsObject->drawButtons()) { setDown(false); } @@ -1023,20 +1030,20 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e) switch (e->button()) { case Qt::LeftButton: - buttonAction = TaskBarSettings::action(TaskBarSettings::LeftButton); + buttonAction = m_settingsObject->action(m_settingsObject->LeftButton); break; case Qt::MidButton: - buttonAction = TaskBarSettings::action(TaskBarSettings::MiddleButton); + buttonAction = m_settingsObject->action(m_settingsObject->MiddleButton); break; case Qt::RightButton: default: - buttonAction = TaskBarSettings::action(TaskBarSettings::RightButton); + buttonAction = m_settingsObject->action(m_settingsObject->RightButton); break; } - if ((buttonAction == TaskBarSettings::ShowTaskList && + if ((buttonAction == m_settingsObject->ShowTaskList && m_filteredTasks.count() > 1) || - buttonAction == TaskBarSettings::ShowOperationsMenu) + buttonAction == m_settingsObject->ShowOperationsMenu) { return; } @@ -1063,13 +1070,13 @@ void TaskContainer::performAction(int action) // If there is only one task, the correct behavior is // to activate, raise, or iconify it, not show the task menu. if( m_filteredTasks.count() > 1 ) { - popupMenu( TaskBarSettings::ShowTaskList ); + popupMenu( m_settingsObject->ShowTaskList ); } else { performAction( TaskBarSettings::ActivateRaiseOrMinimize ); } break; case TaskBarSettings::ShowOperationsMenu: - popupMenu( TaskBarSettings::ShowOperationsMenu ); + popupMenu( m_settingsObject->ShowOperationsMenu ); break; case TaskBarSettings::ActivateRaiseOrMinimize: if (m_filteredTasks.isEmpty()) @@ -1199,11 +1206,11 @@ bool TaskContainer::activateNextTask(bool forward, bool& forcenext) void TaskContainer::popupMenu(int action) { - if (action == TaskBarSettings::ShowTaskList ) + if (action == m_settingsObject->ShowTaskList ) { m_menu = new TaskLMBMenu(m_filteredTasks); } - else if (action == TaskBarSettings::ShowOperationsMenu) + else if (action == m_settingsObject->ShowOperationsMenu) { if (!kapp->authorizeKAction("twin_rmb")) { @@ -1447,7 +1454,7 @@ void TaskContainer::dragSwitch() } else { - popupMenu(TaskBarSettings::ShowTaskList); + popupMenu(m_settingsObject->ShowTaskList); } } @@ -1540,7 +1547,7 @@ void TaskContainer::updateFilteredTaskList() { Task::Ptr t = *it; if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) && - (!TaskBarSettings::showOnlyIconified() || t->isIconified())) + (!m_settingsObject->showOnlyIconified() || t->isIconified())) { pid_t pid = 0; #ifdef Q_WS_X11 @@ -1561,15 +1568,15 @@ void TaskContainer::updateFilteredTaskList() if (pid < 0) { m_filteredTasks.append(t); } - else if (TaskBarSettings::showTaskStates() != TaskBarSettings::ShowAll) { + else if (m_settingsObject->showTaskStates() != m_settingsObject->ShowAll) { if (is_process_resumable(pid)) { - if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowAll) { + if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) { m_filteredTasks.append(t); } - else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowStopped) { + else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) { m_filteredTasks.append(t); } - else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowRunning) { + else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) { t->publishIconGeometry( TQRect()); } else { @@ -1577,13 +1584,13 @@ void TaskContainer::updateFilteredTaskList() } } else { - if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowAll) { + if (m_settingsObject->showTaskStates() == m_settingsObject->ShowAll) { m_filteredTasks.append(t); } - else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowStopped) { + else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowStopped) { t->publishIconGeometry( TQRect()); } - else if (TaskBarSettings::showTaskStates() == TaskBarSettings::ShowRunning) { + else if (m_settingsObject->showTaskStates() == m_settingsObject->ShowRunning) { m_filteredTasks.append(t); } else { @@ -1670,12 +1677,12 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data) if (m_filteredTasks.count() > 0) { - if (TaskBarSettings::showThumbnails() && + if (m_settingsObject->showThumbnails() && m_filteredTasks.count() == 1) { Task::Ptr t = m_filteredTasks.first(); - pixmap = t->thumbnail(TaskBarSettings::thumbnailMaxDimension()); + pixmap = t->thumbnail(m_settingsObject->thumbnailMaxDimension()); } 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()) { diff --git a/kicker/taskbar/taskcontainer.h b/kicker/taskbar/taskcontainer.h index 766d37639..a176a0787 100644 --- a/kicker/taskbar/taskcontainer.h +++ b/kicker/taskbar/taskcontainer.h @@ -33,6 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "taskmanager.h" class TaskBar; +class TaskBarSettings; typedef TQValueList<TQPixmap*> PixmapList; @@ -44,8 +45,8 @@ public: typedef TQValueList<TaskContainer*> List; typedef TQValueList<TaskContainer*>::iterator Iterator; - TaskContainer(Task::Ptr, TaskBar*, TQWidget *parent = 0, const char *name = 0); - TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, + TaskContainer(Task::Ptr, TaskBar*, TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0); + TaskContainer(Startup::Ptr, PixmapList&, TaskBar*, TaskBarSettings* settingsObject, TQWidget *parent = 0, const char *name = 0); virtual ~TaskContainer(); @@ -148,7 +149,8 @@ private: bool m_mouseOver; bool m_paintEventCompression; enum { ATTENTION_BLINK_TIMEOUT = 4 }; - TQPoint m_dragStartPos; + TQPoint m_dragStartPos; + TaskBarSettings* m_settingsObject; }; #endif diff --git a/kioslave/media/mediamanager/tdehardwarebackend.cpp b/kioslave/media/mediamanager/tdehardwarebackend.cpp index f318c5786..15e27a43a 100644 --- a/kioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/kioslave/media/mediamanager/tdehardwarebackend.cpp @@ -496,7 +496,9 @@ void TDEBackend::setVolumeProperties(Medium* medium) } 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)) { |