summaryrefslogtreecommitdiffstats
path: root/kicker/kicker/ui/k_mnu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kicker/kicker/ui/k_mnu.cpp')
-rw-r--r--kicker/kicker/ui/k_mnu.cpp92
1 files changed, 58 insertions, 34 deletions
diff --git a/kicker/kicker/ui/k_mnu.cpp b/kicker/kicker/ui/k_mnu.cpp
index 4362e91f1..768056473 100644
--- a/kicker/kicker/ui/k_mnu.cpp
+++ b/kicker/kicker/ui/k_mnu.cpp
@@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tdetoolbarbutton.h>
#include <twin.h>
#include <popupmenutop.h>
+#include <tdeaccel.h>
#include "client_mnu.h"
#include "container_base.h"
@@ -86,8 +87,8 @@ PanelKMenu::PanelKMenu()
disableAutoClear();
actionCollection = new TDEActionCollection(this);
setCaption(i18n("TDE Menu"));
- connect(Kicker::the(), TQT_SIGNAL(configurationChanged()),
- this, TQT_SLOT(configChanged()));
+ connect(Kicker::the(), TQ_SIGNAL(configurationChanged()),
+ this, TQ_SLOT(configChanged()));
DCOPClient *dcopClient = TDEApplication::dcopClient();
dcopClient->connectDCOPSignal(0, "appLauncher",
"serviceStartedByStorageId(TQString,TQString)",
@@ -95,7 +96,7 @@ PanelKMenu::PanelKMenu()
"slotServiceStartedByStorageId(TQString,TQString)",
false);
displayRepairTimer = new TQTimer( this );
- connect( displayRepairTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(repairDisplay()) );
+ connect( displayRepairTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(repairDisplay()) );
}
PanelKMenu::~PanelKMenu()
@@ -121,15 +122,12 @@ void PanelKMenu::hideMenu()
{
hide();
-#ifdef USE_QT4
- // The hacks below aren't needed any more because Qt4 supports true transparency for the fading logout screen
-#else // USE_QT4
// Try to redraw the area under the menu
// Qt makes this surprisingly difficult to do in a timely fashion!
while (isShown() == true)
kapp->eventLoop()->processEvents(1000);
TQTimer *windowtimer = new TQTimer( this );
- connect( windowtimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(windowClearTimeout()) );
+ connect( windowtimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(windowClearTimeout()) );
windowTimerTimedOut = false;
windowtimer->start( 0, TRUE ); // Wait for all window system events to be processed
while (windowTimerTimedOut == false)
@@ -142,12 +140,11 @@ void PanelKMenu::hideMenu()
// thereby removing a bad shutdown screen artifact while still providing
// a somewhat snappy user interface.
TQTimer *delaytimer = new TQTimer( this );
- connect( delaytimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(windowClearTimeout()) );
+ connect( delaytimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(windowClearTimeout()) );
windowTimerTimedOut = false;
delaytimer->start( 100, TRUE ); // Wait for 100 milliseconds
while (windowTimerTimedOut == false)
kapp->eventLoop()->processEvents(TQEventLoop::ExcludeUserInput, 1000);
-#endif // USE_QT4
}
void PanelKMenu::windowClearTimeout()
@@ -245,13 +242,15 @@ void PanelKMenu::initialize()
return;
}
+ TDEAccel *accel = new TDEAccel(this);
+
if (loadSidePixmap())
{
// in case we've been through here before, let's disconnect
- disconnect(kapp, TQT_SIGNAL(tdedisplayPaletteChanged()),
- this, TQT_SLOT(paletteChanged()));
- connect(kapp, TQT_SIGNAL(tdedisplayPaletteChanged()),
- this, TQT_SLOT(paletteChanged()));
+ disconnect(kapp, TQ_SIGNAL(tdedisplayPaletteChanged()),
+ this, TQ_SLOT(paletteChanged()));
+ connect(kapp, TQ_SIGNAL(tdedisplayPaletteChanged()),
+ this, TQ_SLOT(paletteChanged()));
}
else
{
@@ -265,14 +264,36 @@ void PanelKMenu::initialize()
if (KickerSettings::useSearchBar()) {
TQHBox* hbox = new TQHBox( this );
TDEToolBarButton *clearButton = new TDEToolBarButton( "locationbar_erase", 0, hbox );
- searchEdit = new KPIM::ClickLineEdit(hbox, " "+i18n("Press '/' to search..."));
- hbox->setFocusPolicy(TQ_StrongFocus);
+
+ TQStringList cuts = TQStringList::split(";", KickerSettings::searchShortcut());
+ TQString placeholder;
+ switch( cuts.count() )
+ {
+ case 0:
+ placeholder = i18n(" Click here to search...");
+ break;
+
+ case 1:
+ placeholder = i18n(" Press '%1' to search...").arg(cuts[0]);
+ break;
+
+ case 2:
+ placeholder = i18n(" Press '%1' or '%2' to search...").arg(cuts[0], cuts[1]);
+ break;
+ }
+ searchEdit = new KPIM::ClickLineEdit( hbox, placeholder );
+
+ hbox->setFocusPolicy(TQWidget::StrongFocus);
hbox->setFocusProxy(searchEdit);
hbox->setSpacing( 3 );
- connect(clearButton, TQT_SIGNAL(clicked()), searchEdit, TQT_SLOT(clear()));
- connect(this, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(slotClearSearch()));
- connect(searchEdit, TQT_SIGNAL(textChanged(const TQString&)),
- this, TQT_SLOT( slotUpdateSearch( const TQString&)));
+ connect(clearButton, TQ_SIGNAL(clicked()), searchEdit, TQ_SLOT(clear()));
+ connect(this, TQ_SIGNAL(aboutToHide()), this, TQ_SLOT(slotClearSearch()));
+ connect(searchEdit, TQ_SIGNAL(textChanged(const TQString&)),
+ this, TQ_SLOT( slotUpdateSearch( const TQString&)));
+ accel->insert("search", i18n("Search"), i18n("TDE Menu search"),
+ TDEShortcut(KickerSettings::searchShortcut()),
+ this, TQ_SLOT(slotFocusSearch()));
+
insertItem(hbox, searchLineID, 0);
} else {
searchEdit = NULL;
@@ -369,7 +390,7 @@ void PanelKMenu::initialize()
insertItem(KickerLib::menuIconSet("system-run"),
i18n("Run Command..."),
this,
- TQT_SLOT( slotRunCommand()));
+ TQ_SLOT( slotRunCommand()));
insertSeparator();
}
@@ -377,8 +398,8 @@ void PanelKMenu::initialize()
{
sessionsMenu = new TQPopupMenu( this );
insertItem(KickerLib::menuIconSet("switchuser"), i18n("Switch User"), sessionsMenu);
- connect( sessionsMenu, TQT_SIGNAL(aboutToShow()), TQT_SLOT(slotPopulateSessions()) );
- connect( sessionsMenu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSessionActivated(int)) );
+ connect( sessionsMenu, TQ_SIGNAL(aboutToShow()), TQ_SLOT(slotPopulateSessions()) );
+ connect( sessionsMenu, TQ_SIGNAL(activated(int)), TQ_SLOT(slotSessionActivated(int)) );
}
/*
@@ -388,17 +409,17 @@ void PanelKMenu::initialize()
ksmserver.setGroup("General");
if (ksmserver.readEntry( "loginMode" ) == "restoreSavedSession")
{
- insertItem(KickerLib::menuIconSet("document-save"), i18n("Save Session"), this, TQT_SLOT(slotSaveSession()));
+ insertItem(KickerLib::menuIconSet("document-save"), i18n("Save Session"), this, TQ_SLOT(slotSaveSession()));
}
if (kapp->authorize("lock_screen"))
{
- insertItem(KickerLib::menuIconSet("system-lock-screen"), i18n("Lock Session"), this, TQT_SLOT(slotLock()));
+ insertItem(KickerLib::menuIconSet("system-lock-screen"), i18n("Lock Session"), this, TQ_SLOT(slotLock()));
}
if (kapp->authorize("logout"))
{
- insertItem(KickerLib::menuIconSet("system-log-out"), i18n("Log Out..."), this, TQT_SLOT(slotLogout()));
+ insertItem(KickerLib::menuIconSet("system-log-out"), i18n("Log Out..."), this, TQ_SLOT(slotLogout()));
}
#if 0
@@ -507,7 +528,7 @@ void PanelKMenu::slotSessionActivated( int ent )
void PanelKMenu::doNewSession( bool lock )
{
int result = KMessageBox::warningContinueCancel(
- TQT_TQWIDGET(kapp->desktop()->screen(kapp->desktop()->screenNumber(this))),
+ kapp->desktop()->screen(kapp->desktop()->screenNumber(this)),
i18n("<p>You have chosen to open another desktop session.<br>"
"The current session will be hidden "
"and a new login screen will be displayed.<br>"
@@ -634,7 +655,7 @@ void PanelKMenu::paintEvent(TQPaintEvent * e)
TQPainter p(this);
p.setClipRegion(e->region());
- style().tqdrawPrimitive( TQStyle::PE_PanelPopup, &p,
+ style().drawPrimitive( TQStyle::PE_PanelPopup, &p,
TQRect( 0, 0, width(), height() ),
colorGroup(), TQStyle::Style_Default,
TQStyleOption( frameWidth(), 0 ) );
@@ -705,7 +726,14 @@ void PanelKMenu::slotUpdateSearch(const TQString& searchString)
void PanelKMenu::slotClearSearch()
{
if (searchEdit && searchEdit->text().isEmpty() == false) {
- TQTimer::singleShot(0, searchEdit, TQT_SLOT(clear()));
+ TQTimer::singleShot(0, searchEdit, TQ_SLOT(clear()));
+ }
+}
+
+void PanelKMenu::slotFocusSearch()
+{
+ if (indexOf(searchLineID) >=0 ) {
+ setActiveItem(indexOf(searchLineID));
}
}
@@ -719,12 +747,8 @@ void PanelKMenu::keyPressEvent(TQKeyEvent* e)
// we follow konqueror.
if (!searchEdit) return KPanelMenu::keyPressEvent(e);
- if (e->key() == TQt::Key_Slash && !searchEdit->hasFocus()) {
- if (indexOf(searchLineID) >=0 ) {
- setActiveItem(indexOf(searchLineID));
- }
- }
- else if (e->key() == TQt::Key_Escape && searchEdit->text().isEmpty() == false) {
+
+ if (e->key() == TQt::Key_Escape && searchEdit->text().isEmpty() == false) {
searchEdit->clear();
}
else if (e->key() == TQt::Key_Delete && !searchEdit->hasFocus() &&