summaryrefslogtreecommitdiffstats
path: root/kicker
diff options
context:
space:
mode:
Diffstat (limited to 'kicker')
-rw-r--r--kicker/taskbar/taskbar.cpp94
-rw-r--r--kicker/taskbar/taskbar.h43
-rw-r--r--kicker/taskbar/taskbar.kcfg25
-rw-r--r--kicker/taskbar/taskcontainer.cpp176
-rw-r--r--kicker/taskbar/taskcontainer.h3
-rw-r--r--kicker/taskmanager/taskrmbmenu.cpp77
6 files changed, 231 insertions, 187 deletions
diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp
index 29c06da89..d4e04f6b5 100644
--- a/kicker/taskbar/taskbar.cpp
+++ b/kicker/taskbar/taskbar.cpp
@@ -49,7 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskbar.h"
#include "taskbar.moc"
-#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
+#define READ_MERGED_TASKBAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name )
: Panner( parent, name ),
@@ -81,7 +81,7 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettin
// init
setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
- m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
+ m_sortByAppPrev = READ_MERGED_TASKBAR_SETTING(sortByApp);
// setup animation frames
for (int i = 1; i < 11; i++)
@@ -174,31 +174,40 @@ KTextShadowEngine *TaskBar::textShadowEngine()
return m_textShadowEngine;
}
-
-TQSize TaskBar::sizeHint() const
+int TaskBar::buttonHeight() const
{
- // get our minimum height based on the minimum button height or the
- // height of the font in use, which is largest
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int bh = TQMAX(fm.height(), READ_MERGED_TASKBAR_SETTING(minimumButtonHeight));
+
+ if(showIcons())
+ {
+ bh = TQMAX(bh, READ_MERGED_TASKBAR_SETTING(iconSize));
+ }
+
+ return bh + 2;
+}
+
+int TaskBar::buttonWidth() const
+{
+ return TQMAX(BUTTON_MIN_WIDTH, READ_MERGED_TASKBAR_SETTING(iconSize)) + 2;
+}
- return TQSize(BUTTON_MIN_WIDTH, minButtonHeight);
+
+TQSize TaskBar::sizeHint() const
+{
+ return TQSize(buttonWidth(), buttonHeight());
}
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(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ // get our minimum height based on the minimum button height, the icon size or the
+ // height of the font in use, whichever is largest
if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{
// Vertical layout
// Minimum space allows for one icon, the window list button and the up/down scrollers
- int minHeight = minButtonHeight*3;
+ int minHeight = buttonHeight()*3;
if (minHeight > maxSize.height())
return maxSize;
return TQSize(maxSize.width(), minHeight);
@@ -207,7 +216,7 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
{
// Horizontal layout
// Minimum space allows for one column of icons, the window list button and the left/right scrollers
- int min_width=BUTTON_MIN_WIDTH*3;
+ int min_width=buttonWidth()*3;
if (min_width > maxSize.width())
return maxSize;
return TQSize(min_width, maxSize.height());
@@ -233,16 +242,18 @@ void TaskBar::configure()
bool wasDisplayIconsNText = m_displayIconsNText;
bool wasShowOnlyIconified = m_showOnlyIconified;
int wasShowTaskStates = m_showTaskStates;
+ int wasIconSize = m_iconSize;
- m_showAllWindows = READ_MERGED_TASBKAR_SETTING(showAllWindows);
- m_sortByDesktop = m_showAllWindows && READ_MERGED_TASBKAR_SETTING(sortByDesktop);
- m_displayIconsNText = READ_MERGED_TASBKAR_SETTING(displayIconsNText);
- m_showOnlyIconified = READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
- m_cycleWheel = READ_MERGED_TASBKAR_SETTING(cycleWheel);
- m_showTaskStates = READ_MERGED_TASBKAR_SETTING(showTaskStates);
+ m_showAllWindows = READ_MERGED_TASKBAR_SETTING(showAllWindows);
+ m_sortByDesktop = m_showAllWindows && READ_MERGED_TASKBAR_SETTING(sortByDesktop);
+ m_displayIconsNText = READ_MERGED_TASKBAR_SETTING(displayIconsNText);
+ m_showOnlyIconified = READ_MERGED_TASKBAR_SETTING(showOnlyIconified);
+ m_cycleWheel = READ_MERGED_TASKBAR_SETTING(cycleWheel);
+ m_showTaskStates = READ_MERGED_TASKBAR_SETTING(showTaskStates);
+ m_iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
m_currentScreen = -1; // Show all screens or re-get our screen
- m_showOnlyCurrentScreen = (READ_MERGED_TASBKAR_SETTING(showCurrentScreenOnly) &&
+ m_showOnlyCurrentScreen = (READ_MERGED_TASKBAR_SETTING(showCurrentScreenOnly) &&
TQApplication::desktop()->isVirtualDesktop() &&
TQApplication::desktop()->numScreens() > 1);
@@ -264,7 +275,8 @@ void TaskBar::configure()
wasDisplayIconsNText != m_displayIconsNText ||
wasCycleWheel != m_cycleWheel ||
wasShowOnlyIconified != m_showOnlyIconified ||
- wasShowTaskStates != m_showTaskStates)
+ wasShowTaskStates != m_showTaskStates ||
+ wasIconSize != m_iconSize)
{
// relevant settings changed, update our task containers
for (TaskContainer::Iterator it = containers.begin();
@@ -275,12 +287,12 @@ void TaskBar::configure()
}
}
- if (m_sortByAppPrev != READ_MERGED_TASBKAR_SETTING(sortByApp)) {
- m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
+ if (m_sortByAppPrev != READ_MERGED_TASKBAR_SETTING(sortByApp)) {
+ m_sortByAppPrev = READ_MERGED_TASKBAR_SETTING(sortByApp);
reSort();
}
- TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASBKAR_SETTING(showThumbnails));
+ TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASKBAR_SETTING(showThumbnails));
reLayoutEventually();
}
@@ -409,7 +421,7 @@ void TaskBar::showTaskContainer(TaskContainer* container)
}
// try to place the container after one of the same app
- if (READ_MERGED_TASBKAR_SETTING(sortByApp))
+ if (READ_MERGED_TASKBAR_SETTING(sortByApp))
{
TaskContainer::Iterator it = containers.begin();
for (; it != containers.end(); ++it)
@@ -731,14 +743,12 @@ void TaskBar::reLayout()
// number of rows simply depends on our height which is either the
// minimum button height or the height of the font in use, whichever is
// largest
- TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int minButtonHeight = buttonHeight();
// horizontal layout
if (orientation() == Qt::Horizontal)
{
- int bwidth=BUTTON_MIN_WIDTH;
+ int bwidth=buttonWidth();
int rows = contentsRect().height() / minButtonHeight;
if (rows<1)
rows=1;
@@ -752,20 +762,20 @@ void TaskBar::reLayout()
int bpr = static_cast<int>(ceil(static_cast<double>(list.count()) / rows));
// adjust content size
- if ( contentsRect().width() < bpr * BUTTON_MIN_WIDTH )
+ if ( contentsRect().width() < bpr * bwidth )
{
- resizeContents( bpr * BUTTON_MIN_WIDTH, contentsRect().height() );
+ resizeContents( bpr * bwidth, contentsRect().height() );
}
// maximum number of buttons per row
- int mbpr = contentsRect().width() / BUTTON_MIN_WIDTH;
+ int mbpr = contentsRect().width() / bwidth;
// expand button width if space permits and the taskbar is not in 'icons only' mode
if (mbpr > bpr)
{
if (!showIcons() || showText())
bwidth = contentsRect().width() / bpr;
- int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
+ int maxWidth = READ_MERGED_TASKBAR_SETTING(maximumButtonWidth);
if (maxWidth > 0 && bwidth > maxWidth)
{
bwidth = maxWidth;
@@ -987,9 +997,7 @@ int TaskBar::taskCount() const
int TaskBar::maximumButtonsWithoutShrinking() const
{
- TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int minButtonHeight = buttonHeight();
int rows = contentsRect().height() / minButtonHeight;
if (rows < 1)
@@ -999,7 +1007,7 @@ int TaskBar::maximumButtonsWithoutShrinking() const
if ( orientation() == Qt::Horizontal ) {
// maxWidth of 0 means no max width, drop back to default
- int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
+ int maxWidth = READ_MERGED_TASKBAR_SETTING(maximumButtonWidth);
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@@ -1017,8 +1025,8 @@ int TaskBar::maximumButtonsWithoutShrinking() const
bool TaskBar::shouldGroup() const
{
- return READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
- ((READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
+ return READ_MERGED_TASKBAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
+ ((READ_MERGED_TASKBAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
taskCount() > maximumButtonsWithoutShrinking()));
}
@@ -1166,7 +1174,7 @@ void TaskBar::activateNextTask(bool forward)
void TaskBar::wheelEvent(TQWheelEvent* e)
{
- if(READ_MERGED_TASBKAR_SETTING(cycleWheel)) {
+ if(READ_MERGED_TASKBAR_SETTING(cycleWheel)) {
if (e->delta() > 0)
{
diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h
index 0ab614a61..917e9e2de 100644
--- a/kicker/taskbar/taskbar.h
+++ b/kicker/taskbar/taskbar.h
@@ -137,37 +137,40 @@ protected:
void moveEvent( TQMoveEvent* );
bool idMatch( const TQString& id1, const TQString& id2 );
TaskContainer::List filteredContainers();
+ int buttonHeight() const;
+ int buttonWidth() const;
private:
void sortContainersByDesktop(TaskContainer::List& list);
void setViewportBackground();
- bool blocklayout;
- bool m_showAllWindows;
- bool m_cycleWheel;
- int m_currentScreen; // The screen to show, -1 for all screens
- bool m_showOnlyCurrentScreen;
- bool m_sortByDesktop;
+ bool blocklayout;
+ bool m_showAllWindows;
+ bool m_cycleWheel;
+ int m_currentScreen; // The screen to show, -1 for all screens
+ bool m_showOnlyCurrentScreen;
+ bool m_sortByDesktop;
int m_displayIconsNText;
- bool m_showOnlyIconified;
- int m_showTaskStates;
- ArrowType arrowType;
- TaskContainer::List containers;
- TaskContainer::List m_hiddenContainers;
- TaskContainer::List m_deletableContainers;
- PixmapList frames;
+ bool m_showOnlyIconified;
+ int m_showTaskStates;
+ int m_iconSize;
+ ArrowType arrowType;
+ TaskContainer::List containers;
+ TaskContainer::List m_hiddenContainers;
+ TaskContainer::List m_deletableContainers;
+ PixmapList frames;
int maximumButtonsWithoutShrinking() const;
bool shouldGroup() const;
bool isGrouping;
void reGroup();
TDEGlobalAccel* keys;
- KTextShadowEngine* m_textShadowEngine;
- bool m_ignoreUpdates;
- bool m_sortByAppPrev;
- TQTimer m_relayoutTimer;
- TQImage m_blendGradient;
- TaskBarSettings* m_settingsObject;
- TaskBarSettings* m_globalSettingsObject;
+ KTextShadowEngine* m_textShadowEngine;
+ bool m_ignoreUpdates;
+ bool m_sortByAppPrev;
+ TQTimer m_relayoutTimer;
+ TQImage m_blendGradient;
+ TaskBarSettings* m_settingsObject;
+ TaskBarSettings* m_globalSettingsObject;
};
#endif
diff --git a/kicker/taskbar/taskbar.kcfg b/kicker/taskbar/taskbar.kcfg
index 95596ad34..7436f2e8e 100644
--- a/kicker/taskbar/taskbar.kcfg
+++ b/kicker/taskbar/taskbar.kcfg
@@ -75,9 +75,9 @@
<label>Only Running</label>
</choice>
</choices>
- <default>ShowAll</default>
+ <default>ShowAll</default>
<label>Show tasks with state:</label>
- <whatsthis>The taskbar can show and/or hide tasks based on their current process state. Select <em>Any</em> to show all tasks regardless of current state.</whatsthis>
+ <whatsthis>The taskbar can show and/or hide tasks based on their current process state. Select <em>Any</em> to show all tasks regardless of current state.</whatsthis>
</entry>
<entry key="SortByDesktop" type="Bool" >
<default>true</default>
@@ -91,9 +91,10 @@
</entry>
<entry key="MaximumButtonWidth" type="Int" >
<default>200</default>
- <min>0</min>
- <label></label>
- <whatsthis></whatsthis>
+ <min>50</min>
+ <max>500</max>
+ <label>Maximum button width</label>
+ <whatsthis>The maximum width to which a taskbar item can expand.</whatsthis>
</entry>
<entry key="MinimumButtonHeight" type="Int" >
<default>18</default>
@@ -172,19 +173,20 @@
<label>Draw taskbar entries "flat" and not as a button</label>
<whatsthis>Turning this option on will cause the taskbar to draw visible button frames for each entry in the taskbar. By default, this option is off.</whatsthis>
</entry>
+ <entry key="ShowButtonOnHover" type="Bool" >
+ <default>true</default>
+ <label>Show a visible button frame on the task the cursor is positioned over</label>
+ <whatsthis>Turning this option on will cause the taskbar to draw a visible button frame around the item currently under the mouse. By default, this option is on.</whatsthis>
+ </entry>
<entry key="HaloText" type="Bool" >
<default>false</default>
<label>Draw taskbar text with a halo around it</label>
<whatsthis>Turning this option on will cause the taskbar to draw fancier text that has an outline around it. While this is useful for transparent panels or particularly dark panel backgrounds, it is slower.</whatsthis>
</entry>
- <entry key="ShowButtonOnHover" type="Bool" >
- <default>true</default>
- <label>Show a visible button frame on the task the cursor is positioned over</label>
- </entry>
<entry key="ShowThumbnails" type="Bool" >
<default>false</default>
<label>Show thumbnails instead of icons in the mouse-over effects</label>
- <whatsthis>Enabling this option will draw a thumbnail of the window in its mouse-over effect.<p>If a window is minimized or resides on a different desktop while the taskbar is starting, an icon is shown until the window is restored or the appropriate desktop is activated, respectively.</p></whatsthis>
+ <whatsthis>Enabling this option will draw a thumbnail of the window in its mouse-over effect.<p>If a window is minimized or resides on a different desktop while the taskbar is starting, an icon is shown until the window is restored or the appropriate desktop is activated, respectively. This options needs a TWin compositor in order to work.</p></whatsthis>
</entry>
<entry key="ThumbnailMaxDimension" type="UInt" >
<default>100</default>
@@ -211,5 +213,8 @@
<default code="true">QColor()</default>
<whatsthis>This color is used for displaying background of taskbar buttons.</whatsthis>
</entry>
+ <entry name="IconSize" type="UInt" >
+ <default>16</default>
+ </entry>
</group>
</kcfg>
diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp
index cc533f0b9..6ffd688d3 100644
--- a/kicker/taskbar/taskcontainer.cpp
+++ b/kicker/taskbar/taskcontainer.cpp
@@ -62,8 +62,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskcontainer.h"
#include "taskcontainer.moc"
-#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
-#define READ_MERGED_TASBKAR_ACTION(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->action(x):m_settingsObject->action(x))
+#define READ_MERGED_TASKBAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
+#define READ_MERGED_TASKBAR_ACTION(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->action(x):m_settingsObject->action(x))
static Bool netwm_atoms_created = False;
static Atom net_wm_pid = 0;
@@ -192,9 +192,11 @@ void TaskContainer::init()
if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay());
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
setWFlags(TQt::WNoAutoErase);
setBackgroundMode(NoBackground);
- animBg = TQPixmap(16, 16);
+ animBg = TQPixmap(iconSize, iconSize);
installEventFilter(KickerTip::the());
@@ -366,11 +368,11 @@ void TaskContainer::checkAttention(const Task::Ptr t)
void TaskContainer::attentionTimerFired()
{
assert( attentionState != -1 );
- if (attentionState < READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations)*2)
+ if (attentionState < READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations)*2)
{
++attentionState;
}
- else if (READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) < 1000)
+ else if (READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations) < 1000)
{
attentionTimer.stop();
}
@@ -390,9 +392,22 @@ TQSizePolicy TaskContainer::sizePolicy() const
void TaskContainer::resizeEvent( TQResizeEvent * )
{
- // calculate the icon rect
- TQRect br( style().subRect( TQStyle::SR_PushButtonContents, this ) );
- iconRect = TQStyle::visualRect( TQRect(br.x() + 2, (height() - 16) / 2, 16, 16), this );
+ recalculateIconRect();
+}
+
+void TaskContainer::recalculateIconRect()
+{
+ iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
+ if(taskBar->showText())
+ {
+ TQRect br( style().subRect( TQStyle::SR_PushButtonContents, this ) );
+ iconRect = TQStyle::visualRect( TQRect(br.x() + 2, (height() - iconSize) / 2, iconSize, iconSize), this );
+ }
+ else
+ {
+ iconRect = TQStyle::visualRect( TQRect((width() - iconSize) / 2, (height() - iconSize) / 2, iconSize, iconSize), this );
+ }
}
void TaskContainer::add(Task::Ptr task)
@@ -581,13 +596,14 @@ void TaskContainer::drawButton(TQPainter *p)
TQPixmap *pm((TQPixmap*)p->device());
TQPixmap pixmap; // icon
Task::Ptr task = 0;
- bool iconified = !READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
- bool halo = READ_MERGED_TASBKAR_SETTING(haloText);
- bool alwaysDrawButtons = READ_MERGED_TASBKAR_SETTING(drawButtons);
+ bool iconified = !READ_MERGED_TASKBAR_SETTING(showOnlyIconified);
+ bool halo = READ_MERGED_TASKBAR_SETTING(haloText);
+ bool alwaysDrawButtons = READ_MERGED_TASKBAR_SETTING(drawButtons);
bool drawButton = alwaysDrawButtons ||
(m_mouseOver && !halo && isEnabled() &&
- READ_MERGED_TASBKAR_SETTING(showButtonOnHover));
+ READ_MERGED_TASKBAR_SETTING(showButtonOnHover));
TQFont font(TDEGlobalSettings::taskbarFont());
+ recalculateIconRect();
// draw sunken if we contain the active task
bool active = false;
@@ -608,7 +624,7 @@ void TaskContainer::drawButton(TQPainter *p)
if (task->demandsAttention())
{
- demandsAttention = attentionState == READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) ||
+ demandsAttention = attentionState == READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations) ||
attentionState % 2 == 0;
}
}
@@ -616,15 +632,15 @@ void TaskContainer::drawButton(TQPainter *p)
font.setBold(active);
TQColorGroup colors = palette().active();
-
- if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
+
+ if (READ_MERGED_TASKBAR_SETTING(useCustomColors))
{
- colors.setColor( TQColorGroup::Button, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor));
- colors.setColor( TQColorGroup::Background, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor) );
- colors.setColor( TQColorGroup::ButtonText, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
- colors.setColor( TQColorGroup::Text, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
+ colors.setColor( TQColorGroup::Button, READ_MERGED_TASKBAR_SETTING(taskBackgroundColor));
+ colors.setColor( TQColorGroup::Background, READ_MERGED_TASKBAR_SETTING(taskBackgroundColor) );
+ colors.setColor( TQColorGroup::ButtonText, READ_MERGED_TASKBAR_SETTING(inactiveTaskTextColor) );
+ colors.setColor( TQColorGroup::Text, READ_MERGED_TASKBAR_SETTING(inactiveTaskTextColor) );
}
-
+
if (demandsAttention)
{
if (!drawButton)
@@ -659,7 +675,7 @@ void TaskContainer::drawButton(TQPainter *p)
// get the task icon
if (task)
{
- pixmap = task->pixmap();
+ pixmap = task->icon(iconSize, iconSize, true);
}
bool sunken = isDown() || (alwaysDrawButtons && (active || aboutToActivate));
@@ -671,7 +687,7 @@ void TaskContainer::drawButton(TQPainter *p)
// draw button background
if (drawButton)
{
- if (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) {
+ if (READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) {
style().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p,
TQRect(1, 1, width()-3, height()-2),
colors, sunken ? TQStyle::Style_On : TQStyle::Style_Raised);
@@ -690,21 +706,21 @@ void TaskContainer::drawButton(TQPainter *p)
}
TQString text = name(); // find text
- int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0;
+ int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + iconSize + 2 : 0;
// show icons
if (taskBar->showIcons())
{
if (pixmap.isNull() && m_startup)
- pixmap = SmallIcon(m_startup->icon());
+ pixmap = kapp->iconLoader()->loadIcon(m_startup->icon(), TDEIcon::Panel, iconSize);
if ( !pixmap.isNull() )
{
- // make sure it is no larger than 16x16
- if ( pixmap.width() > 16 || pixmap.height() > 16 )
+ // make sure it is no larger than icon size
+ if ( pixmap.width() > iconSize || pixmap.height() > iconSize )
{
TQImage tmp = pixmap.convertToImage();
- pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) );
+ pixmap.convertFromImage( tmp.smoothScale( iconSize, iconSize ) );
}
// fade out the icon when minimized
@@ -718,28 +734,36 @@ void TaskContainer::drawButton(TQPainter *p)
}
// modified overlay icon
- if (taskBar->showText())
+ static TQString modStr = "[" + i18n( "modified" ) + "]";
+ int modStrPos = text.find( modStr );
+ if (modStrPos >= 0)
{
- static TQString modStr = "[" + i18n( "modified" ) + "]";
- int modStrPos = text.find( modStr );
- if (modStrPos >= 0)
+ TQRect r;
+ TQPixmap modPixmap = SmallIcon("modified");
+ if (iconified)
{
- // +1 because we include a space after the closing brace.
- text.remove(modStrPos, modStr.length() + 1);
- TQPixmap modPixmap = SmallIcon("modified");
+ TDEIconEffect::semiTransparent(modPixmap);
+ }
- // draw modified overlay
- if (!modPixmap.isNull())
- {
- TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - 16) / 2, 16, 16), this);
- if (iconified)
+ if (taskBar->showText()) // has text
+ {
+ // +1 because we include a space after the closing brace.
+ text.remove(modStrPos, modStr.length() + 1);
+
+ // draw modified overlay
+ if (!modPixmap.isNull())
{
- TDEIconEffect::semiTransparent(modPixmap);
+ r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - iconSize) / 2, iconSize, iconSize), this);
+ textPos += iconSize + 2;
}
- p->drawPixmap(r, modPixmap);
- textPos += 16 + 2;
- }
- }
+ }
+ else if (taskBar->showIcons()) // has only icon
+ {
+ r = TQRect(0, 0, iconSize / 2, iconSize / 2);
+ r.moveBottomRight(iconRect.bottomRight());
+ }
+
+ p->drawPixmap(r, modPixmap);
}
}
@@ -765,9 +789,9 @@ void TaskContainer::drawButton(TQPainter *p)
}
else // hack for the dotNET style and others
{
- if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
+ if (READ_MERGED_TASKBAR_SETTING(useCustomColors))
{
- textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
+ textPen = TQPen(READ_MERGED_TASKBAR_SETTING(activeTaskTextColor));
}
else
{
@@ -775,7 +799,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
}
- int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
+ int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
if (m_filteredTasks.count() > 1)
{
availableWidth -= 8;
@@ -852,7 +876,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
// draw popup arrow
- if ((m_filteredTasks.count() > 1) && (!(READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())))
+ if ((m_filteredTasks.count() > 1) && (!(READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())))
{
TQStyle::PrimitiveElement e = TQStyle::PE_ArrowLeft;
@@ -995,14 +1019,14 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e )
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1018,7 +1042,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
{
m_dragStartPos = TQPoint();
- if (!READ_MERGED_TASBKAR_SETTING(drawButtons))
+ if (!READ_MERGED_TASKBAR_SETTING(drawButtons))
{
setDown(false);
}
@@ -1036,14 +1060,14 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1223,7 +1247,7 @@ void TaskContainer::popupMenu(int action)
return;
}
- m_menu = new TaskRMBMenu(m_filteredTasks, taskBar->showAllWindows(), (READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange))?makeTaskMoveMenu():NULL);
+ m_menu = new TaskRMBMenu(m_filteredTasks, taskBar->showAllWindows(), (READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange))?makeTaskMoveMenu():NULL);
}
else
{
@@ -1328,11 +1352,6 @@ void TaskContainer::mouseMoveEvent( TQMouseEvent* e )
bool TaskContainer::startDrag(const TQPoint& pos)
{
- if (m_filteredTasks.count() != 1)
- {
- return false;
- }
-
int delay = TDEGlobalSettings::dndEventDelay();
if ((m_dragStartPos - pos).manhattanLength() > delay)
@@ -1452,7 +1471,7 @@ void TaskContainer::dragEnterEvent( TQDragEnterEvent* e )
return;
}
- if (e->source() && (e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASBKAR_SETTING(sortByApp)))
+ if (e->source() && (e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASKBAR_SETTING(sortByApp)))
{
e->accept();
}
@@ -1480,7 +1499,7 @@ void TaskContainer::dropEvent( TQDropEvent* e )
return;
}
- if ((e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASBKAR_SETTING(sortByApp)))
+ if ((e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASKBAR_SETTING(sortByApp)))
{
if (taskBar->taskMoveHandler(TaskMoveDestination::Position, TaskDrag::decode(e), TQWidget::mapTo(taskBar, e->pos()))) {
e->accept();
@@ -1631,7 +1650,7 @@ void TaskContainer::updateFilteredTaskList()
{
Task::Ptr t = *it;
if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) &&
- (!READ_MERGED_TASBKAR_SETTING(showOnlyIconified) || t->isIconified()))
+ (!READ_MERGED_TASKBAR_SETTING(showOnlyIconified) || t->isIconified()))
{
pid_t pid = 0;
#ifdef Q_WS_X11
@@ -1652,15 +1671,15 @@ void TaskContainer::updateFilteredTaskList()
if (pid < 0) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) != m_settingsObject->ShowAll) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) != m_settingsObject->ShowAll) {
if (is_process_resumable(pid)) {
- if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
t->publishIconGeometry( TQRect());
}
else {
@@ -1668,13 +1687,13 @@ void TaskContainer::updateFilteredTaskList()
}
}
else {
- if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
t->publishIconGeometry( TQRect());
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
m_filteredTasks.append(t);
}
else {
@@ -1742,6 +1761,8 @@ void TaskContainer::settingsChanged()
void TaskContainer::updateKickerTip(KickerTip::Data& data)
{
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
if (m_startup)
{
data.message = m_startup->text();
@@ -1749,7 +1770,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
data.subtext = i18n("Loading application ...");
data.icon = TDEGlobal::iconLoader()->loadIcon(m_startup->icon(),
TDEIcon::Small,
- TDEIcon::SizeMedium,
+ iconSize,
TDEIcon::DefaultState,
0, true);
return;
@@ -1761,21 +1782,18 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
if (m_filteredTasks.count() > 0)
{
- if (READ_MERGED_TASBKAR_SETTING(showThumbnails) &&
+ if (READ_MERGED_TASKBAR_SETTING(showThumbnails) &&
m_filteredTasks.count() == 1)
{
Task::Ptr t = m_filteredTasks.first();
- pixmap = t->thumbnail(READ_MERGED_TASBKAR_SETTING(thumbnailMaxDimension));
+ pixmap = t->thumbnail(READ_MERGED_TASKBAR_SETTING(thumbnailMaxDimension));
}
if (pixmap.isNull() && tasks.count())
{
// try to load icon via net_wm
- pixmap = KWin::icon(tasks.last()->window(),
- TDEIcon::SizeMedium,
- TDEIcon::SizeMedium,
- true);
+ pixmap = KWin::icon(tasks.last()->window(), iconSize, iconSize, true);
}
// Collect all desktops the tasks are on. Sort naturally.
@@ -1809,7 +1827,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
}
}
- if (READ_MERGED_TASBKAR_SETTING(showAllWindows) && KWin::numberOfDesktops() > 1)
+ if (READ_MERGED_TASKBAR_SETTING(showAllWindows) && KWin::numberOfDesktops() > 1)
{
if (desktopMap.isEmpty())
{
diff --git a/kicker/taskbar/taskcontainer.h b/kicker/taskbar/taskcontainer.h
index edaf337b4..cc95b5f8c 100644
--- a/kicker/taskbar/taskcontainer.h
+++ b/kicker/taskbar/taskcontainer.h
@@ -117,6 +117,8 @@ protected:
void popupMenu(int);
void updateFilteredTaskList();
+ void updateIconSize();
+ void recalculateIconRect();
protected slots:
void animationTimerFired();
@@ -144,6 +146,7 @@ private:
PixmapList frames;
int attentionState;
TQRect iconRect;
+ int iconSize;
TQPixmap animBg;
Task::List tasks;
Task::List m_filteredTasks;
diff --git a/kicker/taskmanager/taskrmbmenu.cpp b/kicker/taskmanager/taskrmbmenu.cpp
index 58682196b..cdc6e4532 100644
--- a/kicker/taskmanager/taskrmbmenu.cpp
+++ b/kicker/taskmanager/taskrmbmenu.cpp
@@ -121,22 +121,22 @@ void TaskRMBMenu::fillMenu(Task::Ptr t)
void TaskRMBMenu::fillMenu()
{
- int id;
- setCheckable( true );
+ int id;
+ setCheckable( true );
Task::List::iterator itEnd = tasks.end();
for (Task::List::iterator it = tasks.begin(); it != itEnd; ++it)
{
- Task::Ptr t = (*it);
+ Task::Ptr t = (*it);
- id = insertItem( TQIconSet( t->pixmap() ),
- t->visibleNameWithState(),
- new TaskRMBMenu(t, this) );
- setItemChecked( id, t->isActive() );
- connectItem( id, t, TQT_SLOT( activateRaiseOrIconify() ) );
- }
+ id = insertItem( TQIconSet( t->pixmap() ),
+ t->visibleNameWithState(),
+ new TaskRMBMenu(t, this) );
+ setItemChecked( id, t->isActive() );
+ connectItem( id, t, TQT_SLOT( activateRaiseOrIconify() ) );
+ }
- insertSeparator();
+ insertSeparator();
bool enable = false;
@@ -159,48 +159,55 @@ void TaskRMBMenu::fillMenu()
enable = false;
- id = insertItem( i18n( "Mi&nimize All" ), this, TQT_SLOT( slotMinimizeAll() ) );
+ id = insertItem( i18n( "Mi&nimize All" ), this, TQT_SLOT( slotMinimizeAll() ) );
itEnd = tasks.end();
for (Task::List::iterator it = tasks.begin(); it != itEnd; ++it)
{
- if( !(*it)->isIconified() ) {
- enable = true;
- break;
- }
- }
- setItemEnabled( id, enable );
+ if( !(*it)->isIconified() ) {
+ enable = true;
+ break;
+ }
+ }
+ setItemEnabled( id, enable );
- enable = false;
+ enable = false;
- id = insertItem( i18n( "Ma&ximize All" ), this, TQT_SLOT( slotMaximizeAll() ) );
+ id = insertItem( i18n( "Ma&ximize All" ), this, TQT_SLOT( slotMaximizeAll() ) );
itEnd = tasks.end();
for (Task::List::iterator it = tasks.begin(); it != itEnd; ++it)
{
if( !(*it)->isMaximized() ) {
- enable = true;
- break;
- }
- }
- setItemEnabled( id, enable );
+ enable = true;
+ break;
+ }
+ }
+ setItemEnabled( id, enable );
- enable = false;
+ enable = false;
- id = insertItem( i18n( "&Restore All" ), this, TQT_SLOT( slotRestoreAll() ) );
+ id = insertItem( i18n( "&Restore All" ), this, TQT_SLOT( slotRestoreAll() ) );
itEnd = tasks.end();
for (Task::List::iterator it = tasks.begin(); it != itEnd; ++it)
{
- if( (*it)->isIconified() || (*it)->isMaximized() ) {
- enable = true;
- break;
- }
- }
- setItemEnabled( id, enable );
+ if( (*it)->isIconified() || (*it)->isMaximized() ) {
+ enable = true;
+ break;
+ }
+ }
+ setItemEnabled( id, enable );
+
+ insertSeparator();
+
+ enable = false;
- insertSeparator();
+ if (taskMoveMenu) {
+ taskMoveMenu->reparent(this, taskMoveMenu->getWFlags(), taskMoveMenu->geometry().topLeft(), FALSE);
+ insertItem(i18n("Move Task Button"), taskMoveMenu);
- enable = false;
+ insertSeparator();
+ }
- insertItem( SmallIcon( "remove" ), i18n( "&Close All" ), this, TQT_SLOT( slotCloseAll() ) );
+ insertItem( SmallIcon( "window-close" ), i18n( "&Close All" ), this, TQT_SLOT( slotCloseAll() ) );
}
TQPopupMenu* TaskRMBMenu::makeAdvancedMenu(Task::Ptr t)