diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 20:49:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 20:49:48 +0000 |
commit | fd7a608ffe99df747f0496300276b95f766c18b9 (patch) | |
tree | c54dfe97fb682af9705d2cb09c424c60db861228 /kicker/libkicker | |
parent | 27856879bf962f178d88e79144e37a47e731b122 (diff) | |
download | tdebase-fd7a608ffe99df747f0496300276b95f766c18b9.tar.gz tdebase-fd7a608ffe99df747f0496300276b95f766c18b9.zip |
* Added Kickoff menu
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1171422 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/libkicker')
-rw-r--r-- | kicker/libkicker/kickerSettings.kcfg | 100 | ||||
-rw-r--r-- | kicker/libkicker/kickertip.cpp | 24 | ||||
-rw-r--r-- | kicker/libkicker/kickertip.h | 2 | ||||
-rw-r--r-- | kicker/libkicker/panelbutton.cpp | 56 | ||||
-rw-r--r-- | kicker/libkicker/panelbutton.h | 13 |
5 files changed, 172 insertions, 23 deletions
diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg index 6f7f2427e..99625809d 100644 --- a/kicker/libkicker/kickerSettings.kcfg +++ b/kicker/libkicker/kickerSettings.kcfg @@ -98,6 +98,70 @@ <label>A list of extensions that have been loaded at runtime. In the case of a crash these extensions will not be loaded at the next Kicker start, in case they caused the crash</label> </entry> +<entry name="LegacyKMenu" type="Bool" > + <label>When this option is enabled, the classic K Menu is used.</label> + <default>true</default> + </entry> + +<entry name="OpenOnHover" type="Bool" > + <label>When this option is enabled, the Kickoff Menu opens on mouse hover.</label> + <default>true</default> + </entry> + +<entry name="ScrollFlipView" type="Bool" > + <label>When this option is enabled, the Kickoff Menu application view switching will scroll.</label> + <default>true</default> + </entry> + +<entry name="KMenuWidth" type="Int"> + <label>Preferred width of the KMenu</label> + <default>0</default> + </entry> + +<entry name="KMenuHeight" type="Int"> + <label>Preferred width of the KMenu</label> + <default>0</default> + </entry> + +<entry name="KickoffFontPointSizeOffset" type="Int" > + <label>With this option the scale of the fonts Kickoff uses can be influenced</label> + <default>0</default> + <min>-100</min> + <max>100</max> + </entry> + +<entry name="KickoffSearchAddressBook" type="Bool" > + <label>When this option is enabled, kabc is utilized to search for addresses. This may start KMail.</label> + <default>false</default> + </entry> + +<entry name="KickoffDrawGeekoEye" type="Bool" > + <label>When this option is enabled, the Geeko eye moves when the mouse hovers the start menu button</label> + <default>false</default> + </entry> + +<entry name="KickoffTabBarFormat" type="Enum" > + <choices> + <choice name="LabelAndIcon"> + <label>Show names and icons on tabs</label> + </choice> + <choice name="LabelOnly"> + <label>Show only the names</label> + </choice> + <choice name="IconOnly"> + <label>Show only the icons</label> + </choice> + </choices> + <default>LabelAndIcon</default> + <label>Appearace of the Kickoff tabbar</label> + </entry> + +<entry name="KickoffSwitchTabsOnHover" type="Bool" > + <label>When this option is enabled, the tabs in the Kickoff menu will switch without the need to click</label> + <default>true</default> + </entry> + + </group> <group name="menus"> @@ -177,6 +241,19 @@ <default>false</default> </entry> +<entry name="Favorites" type="StringList"> + <label>The menu entries shown in the Favorites tab</label> + </entry> + +<entry name="FirstRun" type="Bool" > + <label>Whether the panel has been started before or not</label> + <default>false</default> + </entry> + +<entry name="FirstSeenApps" type="StringList"> + <label>When the applications were first seen by Kickoff</label> + </entry> + </group> <group name="button_tiles"> @@ -352,6 +429,29 @@ </group> + <group name="SearchField"> + <entry key="History" type="PathList"> + <default></default> + <label></label> + <whatsthis></whatsthis> + </entry> + <entry key="HistoryLength" type="Int"> + <default>50</default> + <label></label> + <whatsthis></whatsthis> + </entry> + <entry key="CompletionItems" type="PathList"> + <default></default> + <label></label> + <whatsthis></whatsthis> + </entry> + <entry key="CompletionMode" type="Int"> + <default>2</default> + <label></label> + <whatsthis></whatsthis> + </entry> + </group> + </kcfg> diff --git a/kicker/libkicker/kickertip.cpp b/kicker/libkicker/kickertip.cpp index 34cf65c56..215320c84 100644 --- a/kicker/libkicker/kickertip.cpp +++ b/kicker/libkicker/kickertip.cpp @@ -38,6 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // putting this #include higher results in compile errors #include <netwm.h> +#include <assert.h> static const int DEFAULT_FRAMES_PER_SECOND = 30; @@ -71,14 +72,16 @@ KickerTip::KickerTip(TQWidget * parent) m_dissolveDelta(-1), m_direction(KPanelApplet::Up), m_dirty(false), - m_toolTipsEnabled(KickerSettings::showToolTips()), - m_tippingFor(0) + m_tippingFor(0), + m_timer(0, "KickerTip::m_timer"), + m_frameTimer(0, "KickerTip::m_frameTimer") { setFocusPolicy(NoFocus); setBackgroundMode(NoBackground); resize(0, 0); hide(); connect(&m_frameTimer, TQT_SIGNAL(timeout()), TQT_SLOT(internalUpdate())); + connect(kapp, TQT_SIGNAL(settingsChanged(SettingsCategory)), TQT_SLOT(slotSettingsChanged())); } KickerTip::~KickerTip() @@ -87,6 +90,11 @@ KickerTip::~KickerTip() delete m_mimeFactory; } +void KickerTip::slotSettingsChanged() +{ + TQToolTip::setGloballyEnabled(KickerSettings::showToolTips()); +} + void KickerTip::display() { if (!tippingEnabled()) @@ -194,7 +202,7 @@ void KickerTip::paintEvent(TQPaintEvent * e) void KickerTip::mousePressEvent(TQMouseEvent * /*e*/) { - TQToolTip::setGloballyEnabled(m_toolTipsEnabled); + m_timer.stop(); hide(); } @@ -463,8 +471,11 @@ void KickerTip::enableTipping(bool tip) m_tippingEnabled--; } + assert(m_tippingEnabled >= -1); + if (m_tippingEnabled < 1 && m_self) { + m_self->m_timer.stop(); m_self->hide(); } } @@ -480,6 +491,8 @@ void KickerTip::hide() m_timer.stop(); m_frameTimer.stop(); TQWidget::hide(); + + TQToolTip::setGloballyEnabled(KickerSettings::showToolTips()); } bool KickerTip::eventFilter(TQObject *object, TQEvent *event) @@ -508,7 +521,6 @@ bool KickerTip::eventFilter(TQObject *object, TQEvent *event) !qApp->activePopupWidget() && !isTippingFor(widget)) { - m_toolTipsEnabled = TQToolTip::isGloballyEnabled(); TQToolTip::setGloballyEnabled(false); tipFor(widget); @@ -530,8 +542,6 @@ bool KickerTip::eventFilter(TQObject *object, TQEvent *event) } break; case TQEvent::Leave: - TQToolTip::setGloballyEnabled(m_toolTipsEnabled); - m_timer.stop(); if (isTippingFor(widget) && isVisible()) @@ -544,7 +554,7 @@ bool KickerTip::eventFilter(TQObject *object, TQEvent *event) tipFor(0); break; case TQEvent::MouseButtonPress: - TQToolTip::setGloballyEnabled(m_toolTipsEnabled); + m_timer.stop(); hide(); default: break; diff --git a/kicker/libkicker/kickertip.h b/kicker/libkicker/kickertip.h index 6bcc863f8..14118029b 100644 --- a/kicker/libkicker/kickertip.h +++ b/kicker/libkicker/kickertip.h @@ -92,6 +92,7 @@ protected slots: void tipperDestroyed(TQObject* o); void internalUpdate(); void display(); + void slotSettingsChanged(); private: TQBitmap m_mask; @@ -108,7 +109,6 @@ private: TQTimer m_timer; TQTimer m_frameTimer; bool m_dirty; - bool m_toolTipsEnabled; const TQWidget* m_tippingFor; diff --git a/kicker/libkicker/panelbutton.cpp b/kicker/libkicker/panelbutton.cpp index 972e5195e..f1ab69fb8 100644 --- a/kicker/libkicker/panelbutton.cpp +++ b/kicker/libkicker/panelbutton.cpp @@ -44,6 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kipc.h> #include <kstandarddirs.h> #include <klocale.h> +#include <kdebug.h> #include "global.h" @@ -67,6 +68,7 @@ PanelButton::PanelButton( TQWidget* parent, const char* name ) m_hasAcceptedDrag(false), m_arrowDirection(KPanelExtension::Bottom), m_popupDirection(KPanelApplet::Up), + m_iconAlignment(AlignCenter), m_orientation(Horizontal), m_size((KIcon::StdSizes)-1), m_fontPercent(0.40) @@ -188,6 +190,12 @@ void PanelButton::setPopupDirection(KPanelApplet::Direction d) setArrowDirection(KickerLib::directionToPopupPosition(d)); } +void PanelButton::setIconAlignment(AlignmentFlags align) +{ + m_iconAlignment = align; + update(); +} + void PanelButton::setOrientation(Orientation o) { m_orientation = o; @@ -303,7 +311,9 @@ int PanelButton::widthForHeight(int height) const int PanelButton::heightForWidth(int width) const { - return preferredDimension(width); + int rc=preferredDimension(width); + + return rc; } const TQPixmap& PanelButton::labelIcon() const @@ -562,11 +572,16 @@ void PanelButton::drawButtonLabel(TQPainter *p) icon.height() - 2); } + int y = 0; + if (m_iconAlignment & AlignVCenter) + y = (height() - icon.height()) / 2; + else if (m_iconAlignment & AlignBottom) + y = (height() - icon.height()); + if (!m_buttonText.isEmpty() && orientation() == Horizontal) { int h = height(); int w = width(); - int y = (h - icon.height())/2; p->save(); TQFont f = font(); @@ -635,8 +650,11 @@ void PanelButton::drawButtonLabel(TQPainter *p) } else if (!icon.isNull()) { - int y = (height() - icon.height()) / 2; - int x = (width() - icon.width()) / 2; + int x = 0; + if (m_iconAlignment & AlignHCenter) + x = (width() - icon.width()) / 2; + else if (m_iconAlignment & AlignRight) + x = (width() - icon.width()); p->drawPixmap(x, y, icon); } @@ -798,7 +816,19 @@ void PanelButton::loadIcons() TQString nm = m_iconName; KIcon::States defaultState = isEnabled() ? KIcon::DefaultState : KIcon::DisabledState; - m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState, 0L, true); + if (nm=="kmenu-suse") + { + TQString pth = locate( "data", "kicker/pics/kmenu_basic.mng" ); + if (!pth.isEmpty()) + { + m_icon = TQImage(pth); + m_iconh = TQPixmap(m_icon); + m_iconz = TQPixmap(m_icon); + return; + } + } + else + m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState, 0L, true); if (m_icon.isNull()) { @@ -863,7 +893,7 @@ PanelPopupButton::PanelPopupButton(TQWidget *parent, const char *name) connect(this, TQT_SIGNAL(pressed()), TQT_SLOT(slotExecMenu())); } -void PanelPopupButton::setPopup(TQPopupMenu *popup) +void PanelPopupButton::setPopup(TQWidget *popup) { if (m_popup) { @@ -881,7 +911,7 @@ void PanelPopupButton::setPopup(TQPopupMenu *popup) } } -TQPopupMenu *PanelPopupButton::popup() const +TQWidget *PanelPopupButton::popup() const { return m_popup; } @@ -960,7 +990,9 @@ void PanelPopupButton::slotExecMenu() } m_popup->adjustSize(); - m_popup->exec(KickerLib::popupPosition(popupDirection(), m_popup, this)); + if(dynamic_cast<TQPopupMenu*>(m_popup)) + static_cast<TQPopupMenu*>(m_popup)->exec(KickerLib::popupPosition(popupDirection(), m_popup, this)); + // else.. hmm. some derived class has to fix it. } void PanelPopupButton::menuAboutToHide() @@ -970,8 +1002,10 @@ void PanelPopupButton::menuAboutToHide() return; } - setDown(false); - KickerTip::enableTipping(true); + if (isDown()) { + setDown(false); + KickerTip::enableTipping(true); + } } void PanelPopupButton::triggerDrag() @@ -989,3 +1023,5 @@ void PanelPopupButton::setInitialized(bool initialized) m_initialized = initialized; } + + diff --git a/kicker/libkicker/panelbutton.h b/kicker/libkicker/panelbutton.h index 78f36ed5c..770d0e1be 100644 --- a/kicker/libkicker/panelbutton.h +++ b/kicker/libkicker/panelbutton.h @@ -254,9 +254,11 @@ public slots: /** * Sets the direction to pop up the contents of the button. */ - void setPopupDirection(KPanelApplet::Direction d); + virtual void setPopupDirection(KPanelApplet::Direction d); protected: + + void setIconAlignment(AlignmentFlags align); /** * Subclasses must implement this to define the name of the button which is * used to identify this button for saving and loading. It must be unique @@ -391,6 +393,7 @@ private: TQPixmap m_iconz; // mouse over KPanelExtension::Position m_arrowDirection; KPanelApplet::Direction m_popupDirection; + AlignmentFlags m_iconAlignment; Orientation m_orientation; int m_size; double m_fontPercent; @@ -419,12 +422,12 @@ public: * Sets the button's popup menu. * @param popup the menu to pop up */ - void setPopup(TQPopupMenu *popup); + void setPopup(TQWidget *popup); /** * @return the button's popup menu */ - TQPopupMenu *popup() const; + TQWidget *popup() const; bool eventFilter(TQObject *, TQEvent *); virtual void showMenu(); @@ -459,8 +462,8 @@ protected slots: private slots: void menuAboutToHide(); -private: - TQPopupMenu *m_popup; +protected: + TQWidget *m_popup; bool m_pressedDuringPopup; bool m_initialized; |