diff options
Diffstat (limited to 'kcontrol/hwmanager/hwdevicetray.cpp')
-rw-r--r-- | kcontrol/hwmanager/hwdevicetray.cpp | 808 |
1 files changed, 396 insertions, 412 deletions
diff --git a/kcontrol/hwmanager/hwdevicetray.cpp b/kcontrol/hwmanager/hwdevicetray.cpp index 509fe2835..f1726a2a1 100644 --- a/kcontrol/hwmanager/hwdevicetray.cpp +++ b/kcontrol/hwmanager/hwdevicetray.cpp @@ -1,8 +1,8 @@ /* * Copyright 2015 Timothy Pearson <kb9vqf@pearsoncomputing.net> - * + * * This file is part of hwdevicetray, the TDE Hardware Device Monitor System Tray Application - * + * * hwdevicetray is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 @@ -21,58 +21,144 @@ #include <config.h> #endif -#include <tqtimer.h> +#include <cstdlib> +#include <unistd.h> + +#include <tqfileinfo.h> #include <tqimage.h> +#include <tqtimer.h> #include <tqtooltip.h> -#include <tqfileinfo.h> +#include <tqvaluevector.h> +#include <kcmultidialog.h> +#include <tdeglobalaccel.h> +#include <khelpmenu.h> +#include "tdeprocess.h" +#include <kpropertiesdialog.h> #include <krun.h> +#include <tdesimpleconfig.h> +#include <tdestandarddirs.h> + #include <tdeaction.h> #include <tdeapplication.h> -#include <kcmultidialog.h> -#include <kdebug.h> -#include <khelpmenu.h> -#include <kiconloader.h> -#include "kprocess.h" -#include <tdelocale.h> -#include <tdepopupmenu.h> -#include <kstdaction.h> -#include <kstdguiitem.h> #include <tdeglobal.h> +#include <tdehardwaredevices.h> +#include <tdelocale.h> #include <tdemessagebox.h> -#include <kpassivepopup.h> -#include <kstandarddirs.h> -#include <kpropertiesdialog.h> -#include "passworddlg.h" +#include "tdepassivepopupstack.h" +#include <tdepopupmenu.h> #include <dcopclient.h> #include <dcopref.h> -#include <cstdlib> -#include <unistd.h> - -#include "hwdevicetray_configdialog.h" #include "hwdevicetray.h" +#include "hwdevicetray_configdialog.h" -HwDeviceSystemTray::HwDeviceSystemTray(TQWidget* parent, const char *name) - : KSystemTray(parent, name) + +// Storage Device Action +namespace SDActions +{ + // use 'int' as underlying type to avoid exposing a bunch of unnecessary + // enums/structs in the class header file private methods' signature + // Note: must start from 0 because the Type value is also used as index + // of a TQValueVector + enum Type : int + { + Open = 0, + Mount, + Unmount, + Unlock, + Lock, + Eject, + SafeRemove, + Properties + }; + + struct Details + { + const char *iconName; + const char *actionName; + const char *collectionName; + }; + + // Allows to use a for loop to iterate over all action types + static const Type All[] = { Open, Mount, Unmount, Unlock, Lock, Eject, SafeRemove, Properties }; + + static const TQMap<Type, Details> populateMap() + { + TQMap<Type, Details> map; + map[Open] = { "window-new", I18N_NOOP("Open"), "open_menu" }; + map[Mount] = { "drive-harddisk-mounted", I18N_NOOP("Mount"), "mount_menu" }; + map[Unmount] = { "drive-harddisk-unmounted", I18N_NOOP("Unmount"), "unmount_menu" }; + map[Unlock] = { "decrypted", I18N_NOOP("Unlock"), "unlock_menu" }; + map[Lock] = { "encrypted", I18N_NOOP("Lock"), "lock_menu" }; + map[Eject] = { "player_eject", I18N_NOOP("Eject"), "eject_menu" }; + map[SafeRemove] = { "player_safe_removal", I18N_NOOP("Safe remove"), "safe_remove_menu" }; + map[Properties] = { "edit", I18N_NOOP("Properties"), "properties_menu" }; + return map; + } + + static const TQMap<Type, Details> Data = populateMap(); +} + +// Storage Device Action Menu Entry, representing an action +// and the storage device on which to perform it +struct SDActionMenuEntry +{ + SDActions::Type actionType; + TQString uuid; +}; + +struct KnownDiskDeviceInfo +{ + TQString deviceLabel; + TQString node; +}; + + +class HwDeviceSystemTrayPrivate +{ +public: + HwDeviceSystemTrayPrivate() + { + } + + ~HwDeviceSystemTrayPrivate() + { + } + + // Members + TDEAction *m_deviceManagerAction; + TDEAction *m_quitAction; + TDEAction *m_shortcutKeysAction; + KHelpMenu *m_helpMenu; + TDEPopupMenu *m_LMBMenu; + TDEPopupMenu *m_RMBMenu; + + TQMap<int, SDActionMenuEntry> m_actionMenuEntryMap; + TQMap<SDActions::Type, TDEActionMenu*> m_RMBActionMenuMap; + + TQMap<TQString, KnownDiskDeviceInfo> m_knownDiskDevices; + + TDEPassivePopupStackContainer *m_hardwareNotifierContainer; +}; + + +HwDeviceSystemTray::HwDeviceSystemTray(TQWidget *parent, const char *name) + : KSystemTray(parent, name), d(new HwDeviceSystemTrayPrivate()) { // Create notifier - m_hardwareNotifierContainer = new TDEPassivePopupStackContainer(); - connect(m_hardwareNotifierContainer, TQT_SIGNAL(popupClicked(KPassivePopup*, TQPoint, TQString)), this, TQT_SLOT(devicePopupClicked(KPassivePopup*, TQPoint, TQString))); + d->m_hardwareNotifierContainer = new TDEPassivePopupStackContainer(); + connect(d->m_hardwareNotifierContainer, TQ_SIGNAL(popupClicked(KPassivePopup*, TQPoint, TQString)), this, TQ_SLOT(devicePopupClicked(KPassivePopup*, TQPoint, TQString))); - // Create help submenu - m_help = new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection()); - TDEPopupMenu *help = m_help->menu(); - help->connectItem(KHelpMenu::menuHelpContents, this, TQT_SLOT(slotHelpContents())); + initMenus(); setPixmap(KSystemTray::loadIcon("hwinfo")); - setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - connect(this, TQT_SIGNAL(quitSelected()), this, TQT_SLOT(_quit())); + setAlignment(TQt::AlignHCenter | TQt::AlignVCenter); + connect(this, TQ_SIGNAL(quitSelected()), this, TQ_SLOT(quitApp())); TQToolTip::add(this, i18n("Device monitor")); - m_parent = parent; - globalKeys = new TDEGlobalAccel(TQT_TQOBJECT(this)); + globalKeys = new TDEGlobalAccel(this); TDEGlobalAccel* keys = globalKeys; #include "hwdevicetray_bindings.cpp" // the keys need to be read from tdeglobals, not kickerrc @@ -80,42 +166,35 @@ HwDeviceSystemTray::HwDeviceSystemTray(TQWidget* parent, const char *name) globalKeys->setEnabled(true); globalKeys->updateConnections(); - connect(kapp, TQT_SIGNAL(settingsChanged(int)), TQT_SLOT(slotSettingsChanged(int))); - - new TDEActionMenu(i18n("Open"), SmallIcon("window-new", TQIconSet::Automatic), actionCollection(), "open_menu"); - new TDEActionMenu(i18n("Mount"), SmallIcon("drive-harddisk-mounted", TQIconSet::Automatic), actionCollection(), "mount_menu"); - new TDEActionMenu(i18n("Unmount"), SmallIcon("drive-harddisk-unmounted", TQIconSet::Automatic), actionCollection(), "unmount_menu"); - new TDEActionMenu(i18n("Unlock"), SmallIcon("decrypted", TQIconSet::Automatic), actionCollection(), "unlock_menu"); - new TDEActionMenu(i18n("Lock"), SmallIcon("encrypted", TQIconSet::Automatic), actionCollection(), "lock_menu"); - new TDEActionMenu(i18n("Eject"), SmallIcon("player_eject", TQIconSet::Automatic), actionCollection(), "eject_menu"); - new TDEActionMenu(i18n("Safe remove"), SmallIcon("player_safe_removal", TQIconSet::Automatic), actionCollection(), "safe_remove_menu"); - new TDEActionMenu(i18n("Properties"), SmallIcon("edit", TQIconSet::Automatic), actionCollection(), "properties_menu"); + connect(tdeApp, TQ_SIGNAL(settingsChanged(int)), TQ_SLOT(slotSettingsChanged(int))); TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); doDiskNotifications(true); - connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(deviceAdded(TDEGenericDevice*))); - connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(deviceRemoved(TDEGenericDevice*))); - connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQ_SLOT(deviceAdded(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQ_SLOT(deviceRemoved(TDEGenericDevice*))); + connect(hwdevices, TQ_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQ_SLOT(deviceChanged(TDEGenericDevice*))); } HwDeviceSystemTray::~HwDeviceSystemTray() { - delete m_hardwareNotifierContainer; + delete d->m_hardwareNotifierContainer; + delete d; } /*! - * \b TQT_SLOT which called if hwdevicetray is exited by the user. In this case the user + * \b TQ_SLOT which called if hwdevicetray is exited by the user. In this case the user * is asked through a yes/no box if "HwDeviceTray should start automatically on log in" and the * result is written to the KDE configfile. */ -void HwDeviceSystemTray::_quit () { - r_config = new KSimpleConfig("tdehwdevicetrayrc"); +void HwDeviceSystemTray::quitApp() +{ + TDESimpleConfig *config = new TDESimpleConfig("tdehwdevicetrayrc"); - TQString tmp1 = i18n ("Start device monitor automatically when you log in?"); - int tmp2 = KMessageBox::questionYesNo (0, tmp1, i18n("Question"), i18n("Start Automatically"), i18n("Do Not Start")); - r_config->setGroup("General"); - r_config->writeEntry ("Autostart", tmp2 == KMessageBox::Yes); - r_config->sync (); + TQString tmp1 = i18n("Start device monitor automatically when you log in?"); + int tmp2 = KMessageBox::questionYesNo(0, tmp1, i18n("Question"), i18n("Start Automatically"), i18n("Do Not Start")); + config->setGroup("General"); + config->writeEntry("Autostart", tmp2 == KMessageBox::Yes); + config->sync(); exit(0); } @@ -142,16 +221,28 @@ void HwDeviceSystemTray::showEvent (TQShowEvent *) { resizeTrayIcon(); } -void HwDeviceSystemTray::mousePressEvent(TQMouseEvent* e) { - // Popup the context menu with left-click - if (e->button() == Qt::LeftButton) { - contextMenuAboutToShow(contextMenu()); - contextMenu()->popup(e->globalPos()); - e->accept(); - return; +void HwDeviceSystemTray::mousePressEvent(TQMouseEvent* e) +{ + switch (e->button()) + { + case TQt::LeftButton: + populateLMBMenu(); + d->m_LMBMenu->popup(e->globalPos()); + break; + + case TQt::MidButton: + TQTimer::singleShot(0, this, TQ_SLOT(slotHardwareConfig())); + break; + + case TQt::RightButton: + contextMenuAboutToShow(d->m_RMBMenu); + d->m_RMBMenu->popup(e->globalPos()); + break; + + default: + // do nothing + break; } - - KSystemTray::mousePressEvent(e); } bool HwDeviceSystemTray::isMonitoredDevice(TDEStorageDevice* sdevice) @@ -195,107 +286,128 @@ bool HwDeviceSystemTray::isMonitoredDevice(TDEStorageDevice* sdevice) sdevice->isDiskOfType(TDEDiskDeviceType::Camera))); } -void HwDeviceSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu) { - menu->clear(); - menu->setCheckable(true); +void HwDeviceSystemTray::initMenus() +{ + // RMB menu + d->m_RMBMenu = contextMenu(); - populateMenu(menu); + // Device actions + for (const SDActions::Type &actionType : SDActions::All) + { + SDActions::Details ad = SDActions::Data[actionType]; + d->m_RMBActionMenuMap.insert(actionType, new TDEActionMenu(i18n(ad.actionName), + SmallIcon(ad.iconName, TQIconSet::Automatic), actionCollection(), ad.collectionName)); + } - menu->insertTitle(SmallIcon("configure"), i18n("Global Configuration")); + // Global Configuration + d->m_deviceManagerAction = new TDEAction(i18n("Show Device Manager..."), SmallIconSet("kcmpci"), + TDEShortcut(), this, TQ_SLOT(slotHardwareConfig()), actionCollection()); + d->m_shortcutKeysAction = new TDEAction(i18n("Configure Shortcut Keys..."), SmallIconSet("configure"), + TDEShortcut(), this, TQ_SLOT(slotEditShortcutKeys()), actionCollection()); - TDEAction *actHardwareConfig = new TDEAction(i18n("Show Device Manager..."), SmallIconSet("kcmpci"), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT(slotHardwareConfig()), actionCollection()); - actHardwareConfig->plug(menu); + // Help & Quit + d->m_helpMenu = new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection()); + d->m_helpMenu->menu()->connectItem(KHelpMenu::menuHelpContents, this, TQ_SLOT(slotHelpContents())); + d->m_quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit)); - TDEAction *actShortcutKeys = new TDEAction(i18n("Configure Shortcut Keys..."), SmallIconSet("configure"), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT(slotEditShortcutKeys()), actionCollection()); - actShortcutKeys->plug(menu); + // LMB menu + d->m_LMBMenu = new TDEPopupMenu(this); +} - menu->insertItem(SmallIcon("help"), KStdGuiItem::help().text(), m_help->menu()); - TDEAction *quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit)); - quitAction->plug(menu); +TQString HwDeviceSystemTray::getDeviceLabel(TDEStorageDevice *sdevice) +{ + if (!sdevice) + { + return TQString::null; + } + + DCOPRef mediamanager("kded", "mediamanager"); + DCOPReply reply = mediamanager.call("properties", sdevice->deviceNode()); + TQString deviceLabel = TQString::null; + if (reply.isValid()) + { + // TODO R14.2.0: make sure the reply is a valid Medium + // once the media library is part of tdelibs + TQStringList properties = reply; + if (properties.size() >= 4) + { + deviceLabel = properties[3]; // medium label + } + } + + if (deviceLabel.isEmpty()) + { + deviceLabel = !sdevice->diskLabel().isEmpty() ? sdevice->diskLabel() : sdevice->friendlyName(); + deviceLabel += " (" + sdevice->deviceNode() + ")"; + } - m_menu = menu; + return deviceLabel; } -void HwDeviceSystemTray::configChanged() { - // +void HwDeviceSystemTray::addDeviceToLMBMenu(TDEStorageDevice *sdevice, const int type, + TDEActionMenu *actionMenu, int &actionMenuIdx) +{ + TQString uuid = !sdevice->diskUUID().isEmpty() ? sdevice->diskUUID() : sdevice->systemPath(); + SDActions::Type actionType = (SDActions::Type)type; + SDActions::Details ad = SDActions::Data[actionType]; + actionMenu->popupMenu()->insertItem(SmallIcon(ad.iconName), i18n(ad.actionName), actionMenuIdx); + actionMenu->popupMenu()->connectItem(actionMenuIdx, this, + TQ_SLOT(slotExecuteDeviceAction(int))); + d->m_actionMenuEntryMap[actionMenuIdx++] = { actionType, uuid }; } -void HwDeviceSystemTray::populateMenu(TDEPopupMenu* menu) { - menu->insertTitle(SmallIcon("drive-harddisk-unmounted"), i18n("Storage Devices")); - - TDEActionMenu *openDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("open_menu")); - TDEActionMenu *mountDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("mount_menu")); - TDEActionMenu *unmountDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("unmount_menu")); - TDEActionMenu *unlockDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("unlock_menu")); - TDEActionMenu *lockDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("lock_menu")); - TDEActionMenu *ejectDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("eject_menu")); - TDEActionMenu *safeRemoveDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("safe_remove_menu")); - TDEActionMenu *propertiesDeviceActionMenu = static_cast<TDEActionMenu*>(actionCollection()->action("properties_menu")); - - openDeviceActionMenu->popupMenu()->clear(); - mountDeviceActionMenu->popupMenu()->clear(); - unmountDeviceActionMenu->popupMenu()->clear(); - unlockDeviceActionMenu->popupMenu()->clear(); - lockDeviceActionMenu->popupMenu()->clear(); - ejectDeviceActionMenu->popupMenu()->clear(); - safeRemoveDeviceActionMenu->popupMenu()->clear(); - propertiesDeviceActionMenu->popupMenu()->clear(); - - m_openMenuIndexMap.clear(); - m_mountMenuIndexMap.clear(); - m_unmountMenuIndexMap.clear(); - m_unlockMenuIndexMap.clear(); - m_lockMenuIndexMap.clear(); - m_ejectMenuIndexMap.clear(); - m_safeRemoveMenuIndexMap.clear(); - m_propertiesMenuIndexMap.clear(); +void HwDeviceSystemTray::addDeviceToRMBMenu(TDEStorageDevice *sdevice, const int type, int &actionMenuIdx) +{ + TQString uuid = !sdevice->diskUUID().isEmpty() ? sdevice->diskUUID() : sdevice->systemPath(); + SDActions::Type actionType = (SDActions::Type)type; + TDEActionMenu *actionMenu = d->m_RMBActionMenuMap[actionType]; + actionMenu->popupMenu()->insertItem(sdevice->icon(TDEIcon::SizeSmall), + getDeviceLabel(sdevice), actionMenuIdx); + actionMenu->popupMenu()->connectItem(actionMenuIdx, this, + TQ_SLOT(slotExecuteDeviceAction(int))); + actionMenu->setEnabled(true); + d->m_actionMenuEntryMap[actionMenuIdx++] = { actionType, uuid }; +} - // Find all storage devices and add them to the popup menus - int lastOpenIndex = -1; - int lastMountIndex = -1; - int lastUnmountIndex = -1; - int lastUnlockIndex = -1; - int lastLockIndex = -1; - int lastEjectIndex = -1; - int lastSafeRemoveIndex = -1; - int lastPropertiesIndex = -1; +void HwDeviceSystemTray::contextMenuAboutToShow(TDEPopupMenu *menu) +{ + d->m_RMBMenu = menu; + menu->clear(); + for (const SDActions::Type &actionType : SDActions::All) + { + TDEActionMenu *actionMenu = d->m_RMBActionMenuMap[actionType]; + actionMenu->popupMenu()->clear(); + actionMenu->setEnabled(false); + actionMenu->unplug(d->m_RMBMenu); + } + + d->m_actionMenuEntryMap.clear(); + + // Find all storage devices, sort them by label and add them to the popup menus + TQValueVector<TQMap<TQString, TDEStorageDevice*>*> rmbMenuEntries(sizeof(SDActions::All) / sizeof(SDActions::Type), nullptr); + for (size_t idx = 0; idx < rmbMenuEntries.size(); ++idx) + { + rmbMenuEntries[idx] = new TQMap<TQString, TDEStorageDevice*>(); + } TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) { - TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); + TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); if (isMonitoredDevice(sdevice)) { - TQString friendlyName = sdevice->diskLabel(); - if (friendlyName.isEmpty()) - { - friendlyName = sdevice->friendlyName(); - } - - if (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted)) + TQString deviceLabel = getDeviceLabel(sdevice); + if (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || + sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted)) { if (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt)) { - lastLockIndex = lockDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - lockDeviceActionMenu->popupMenu()->connectItem(lastLockIndex, this, TQT_SLOT(slotLockDevice(int))); - m_lockMenuIndexMap[lastLockIndex] = sdevice->diskUUID(); - if (m_lockMenuIndexMap[lastLockIndex] == "") - { - m_lockMenuIndexMap[lastLockIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Lock])[deviceLabel] = sdevice; } else { - lastUnlockIndex = unlockDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - unlockDeviceActionMenu->popupMenu()->connectItem(lastUnlockIndex, this, TQT_SLOT(slotUnlockDevice(int))); - m_unlockMenuIndexMap[lastUnlockIndex] = sdevice->diskUUID(); - if (m_unlockMenuIndexMap[lastUnlockIndex] == "") - { - m_unlockMenuIndexMap[lastUnlockIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Unlock])[deviceLabel] = sdevice; } } @@ -303,245 +415,135 @@ void HwDeviceSystemTray::populateMenu(TDEPopupMenu* menu) { { if (sdevice->mountPath().isEmpty()) { - lastMountIndex = mountDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - mountDeviceActionMenu->popupMenu()->connectItem(lastMountIndex, this, TQT_SLOT(slotMountDevice(int))); - m_mountMenuIndexMap[lastMountIndex] = sdevice->diskUUID(); - if (m_mountMenuIndexMap[lastMountIndex] == "") - { - m_mountMenuIndexMap[lastMountIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Mount])[deviceLabel] = sdevice; } else { - lastUnmountIndex = unmountDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - unmountDeviceActionMenu->popupMenu()->connectItem(lastUnmountIndex, this, TQT_SLOT(slotUnmountDevice(int))); - m_unmountMenuIndexMap[lastUnmountIndex] = sdevice->diskUUID(); - if (m_unmountMenuIndexMap[lastMountIndex] == "") - { - m_unmountMenuIndexMap[lastMountIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Unmount])[deviceLabel] = sdevice; } - // Both mounted and unmounted disks can be opened - lastOpenIndex = openDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - openDeviceActionMenu->popupMenu()->connectItem(lastOpenIndex, this, TQT_SLOT(slotOpenDevice(int))); - m_openMenuIndexMap[lastOpenIndex] = sdevice->diskUUID(); - if (m_openMenuIndexMap[lastOpenIndex] == "") - { - m_openMenuIndexMap[lastOpenIndex] = sdevice->systemPath(); - } + // Mounted and unmounted disks can also be opened + (*rmbMenuEntries[SDActions::Open])[deviceLabel] = sdevice; } - if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable) || - sdevice->checkDiskStatus(TDEDiskDeviceStatus::Hotpluggable)) + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) { - lastEjectIndex = ejectDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - ejectDeviceActionMenu->popupMenu()->connectItem(lastEjectIndex, this, TQT_SLOT(slotEjectDevice(int))); - m_ejectMenuIndexMap[lastEjectIndex] = sdevice->diskUUID(); - if (m_ejectMenuIndexMap[lastEjectIndex] == "") - { - m_ejectMenuIndexMap[lastEjectIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Eject])[deviceLabel] = sdevice; - lastSafeRemoveIndex = safeRemoveDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - safeRemoveDeviceActionMenu->popupMenu()->connectItem(lastSafeRemoveIndex, this, TQT_SLOT(slotSafeRemoveDevice(int))); - m_safeRemoveMenuIndexMap[lastSafeRemoveIndex] = sdevice->diskUUID(); - if (m_safeRemoveMenuIndexMap[lastSafeRemoveIndex] == "") - { - m_safeRemoveMenuIndexMap[lastSafeRemoveIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::SafeRemove])[deviceLabel] = sdevice; } - lastPropertiesIndex = propertiesDeviceActionMenu->popupMenu()->insertItem(hwdevice->icon(TDEIcon::SizeSmall), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode())); - propertiesDeviceActionMenu->popupMenu()->connectItem(lastPropertiesIndex, this, TQT_SLOT(slotPropertiesDevice(int))); - m_propertiesMenuIndexMap[lastPropertiesIndex] = sdevice->diskUUID(); - if (m_propertiesMenuIndexMap[lastPropertiesIndex] == "") - { - m_propertiesMenuIndexMap[lastPropertiesIndex] = sdevice->systemPath(); - } + (*rmbMenuEntries[SDActions::Properties])[deviceLabel] = sdevice; } } - openDeviceActionMenu->setEnabled(lastOpenIndex != -1); - mountDeviceActionMenu->setEnabled(lastMountIndex != -1); - unmountDeviceActionMenu->setEnabled(lastUnmountIndex != -1); - unlockDeviceActionMenu->setEnabled(lastUnlockIndex != -1); - lockDeviceActionMenu->setEnabled(lastLockIndex != -1); - ejectDeviceActionMenu->setEnabled(lastEjectIndex != -1); - safeRemoveDeviceActionMenu->setEnabled(lastSafeRemoveIndex != -1); - propertiesDeviceActionMenu->setEnabled(lastPropertiesIndex != -1); - - if (lastOpenIndex != -1) - { - openDeviceActionMenu->plug(menu); - } - if (lastMountIndex != -1) - { - mountDeviceActionMenu->plug(menu); - } - if (lastUnmountIndex != -1) - { - unmountDeviceActionMenu->plug(menu); - } - if (lastUnlockIndex != -1) - { - unlockDeviceActionMenu->plug(menu); - } - if (lastLockIndex != -1) - { - lockDeviceActionMenu->plug(menu); - } - if (lastEjectIndex != -1) - { - ejectDeviceActionMenu->plug(menu); - } - if (lastSafeRemoveIndex != -1) - { - safeRemoveDeviceActionMenu->plug(menu); - } - if (lastPropertiesIndex != -1) + // Plug in meaningful action menus + d->m_RMBMenu->insertTitle(SmallIcon("drive-harddisk-unmounted"), i18n("Storage Device Actions"), 0); + int actionMenuIdx = 0; + for (const SDActions::Type &actionType : SDActions::All) { - propertiesDeviceActionMenu->plug(menu); + TDEActionMenu *actionMenu = d->m_RMBActionMenuMap[actionType]; + for (TDEStorageDevice *sdevice : *rmbMenuEntries[actionType]) + { + addDeviceToRMBMenu(sdevice, actionType, actionMenuIdx); + } + if (actionMenu->isEnabled()) + { + actionMenu->plug(d->m_RMBMenu); + } + delete rmbMenuEntries[actionType]; + rmbMenuEntries[actionType] = nullptr; } + + // Global Configuration + menu->insertTitle(SmallIcon("configure"), i18n("Global Configuration")); + + d->m_deviceManagerAction->plug(menu); + d->m_shortcutKeysAction->plug(menu); + + // Help & Quit + menu->insertSeparator(); + menu->insertItem(SmallIcon("help"), KStdGuiItem::help().text(), d->m_helpMenu->menu()); + d->m_quitAction->plug(menu); } -void HwDeviceSystemTray::slotOpenDevice(int parameter) +void HwDeviceSystemTray::populateLMBMenu() { - TQString uuid = m_openMenuIndexMap[parameter]; - if (!uuid.isEmpty()) + d->m_LMBMenu->clear(); + d->m_LMBMenu->insertTitle(SmallIcon("drive-harddisk-unmounted"), i18n("Storage Devices"), 0); + + d->m_actionMenuEntryMap.clear(); + int actionMenuIdx = 0; + + // Find all storage devices and add them to the popup menus + TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); + TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); + TQMap<TQString, TDEActionMenu*> lmbMenuEntries; + for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) + TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); + if (isMonitoredDevice(sdevice) && + (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || + sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted) || + sdevice->checkDiskStatus(TDEDiskDeviceStatus::Mountable) || + sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable))) { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) + TQString deviceLabel = getDeviceLabel(sdevice); + TDEActionMenu *actionMenu = new TDEActionMenu(deviceLabel, + sdevice->icon(TDEIcon::SizeSmall)); + + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Mountable)) { - if (sdevice->isDiskOfType(TDEDiskDeviceType::Camera)) + // Mounted and unmounted disks can also be opened + addDeviceToLMBMenu(sdevice, SDActions::Open, actionMenu, actionMenuIdx); + + if (sdevice->mountPath().isEmpty()) { - new KRun(TQString("media:/%1").arg(sdevice->friendlyName())); + addDeviceToLMBMenu(sdevice, SDActions::Mount, actionMenu, actionMenuIdx); } else { - new KRun(TQString("system:/media/%1").arg(TQFileInfo(sdevice->deviceNode()).baseName(true))); + addDeviceToLMBMenu(sdevice, SDActions::Unmount, actionMenu, actionMenuIdx); } - return; } - } - } -} -void HwDeviceSystemTray::slotMountDevice(int parameter) -{ - TQString uuid = m_mountMenuIndexMap[parameter]; - if (!uuid.isEmpty()) - { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) - { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) + if (sdevice->isDiskOfType(TDEDiskDeviceType::LUKS) || + sdevice->isDiskOfType(TDEDiskDeviceType::OtherCrypted)) { - if (sdevice->mountPath().isEmpty()) + if (sdevice->isDiskOfType(TDEDiskDeviceType::UnlockedCrypt)) { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-m" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) - { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); - } + addDeviceToLMBMenu(sdevice, SDActions::Lock, actionMenu, actionMenuIdx); } - } - } - } -} - -void HwDeviceSystemTray::slotUnmountDevice(int parameter) -{ - TQString uuid = m_unmountMenuIndexMap[parameter]; - if (!uuid.isEmpty()) - { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) - { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) - { - if (!sdevice->mountPath().isEmpty()) + else { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-u" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) - { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); - } + addDeviceToLMBMenu(sdevice, SDActions::Unlock, actionMenu, actionMenuIdx); } } - } - } -} -void HwDeviceSystemTray::slotUnlockDevice(int parameter) -{ - TQString uuid = m_unlockMenuIndexMap[parameter]; - if (!uuid.isEmpty()) - { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) - { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) + + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-k" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) - { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); - } + addDeviceToLMBMenu(sdevice, SDActions::Eject, actionMenu, actionMenuIdx); + + addDeviceToLMBMenu(sdevice, SDActions::SafeRemove, actionMenu, actionMenuIdx); } + + addDeviceToLMBMenu(sdevice, SDActions::Properties, actionMenu, actionMenuIdx); + + lmbMenuEntries[deviceLabel] = actionMenu; } } -} - -void HwDeviceSystemTray::slotLockDevice(int parameter) -{ - TDEGenericDevice *hwdevice; - TQString uuid = m_lockMenuIndexMap[parameter]; - if (!uuid.isEmpty()) + // Insert menu entries in sorted order + for (TDEActionMenu *am : lmbMenuEntries) { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) - { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-l" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) - { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); - } - } - } + am->plug(d->m_LMBMenu); } } -void HwDeviceSystemTray::slotEjectDevice(int parameter) +void HwDeviceSystemTray::slotExecuteDeviceAction(int parameter) { - TQString uuid = m_ejectMenuIndexMap[parameter]; + TQString uuid = d->m_actionMenuEntryMap[parameter].uuid; + int actionType = d->m_actionMenuEntryMap[parameter].actionType; if (!uuid.isEmpty()) { TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -551,56 +553,42 @@ void HwDeviceSystemTray::slotEjectDevice(int parameter) TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-e" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) + if (actionType == SDActions::Open) { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); + if (sdevice->isDiskOfType(TDEDiskDeviceType::Camera)) + { + new KRun(TQString("media:/%1").arg(sdevice->friendlyName())); + } + else + { + new KRun(TQString("system:/media/%1").arg(TQFileInfo(sdevice->deviceNode()).baseName(true))); + } } - } - } - } -} - -void HwDeviceSystemTray::slotSafeRemoveDevice(int parameter) -{ - TQString uuid = m_safeRemoveMenuIndexMap[parameter]; - if (!uuid.isEmpty()) - { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) - { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) - { - TDEProcess proc; - proc << "tdeio_media_mounthelper" << "-s" << sdevice->deviceNode(); - if (!proc.start(TDEProcess::DontCare)) + else if (actionType == SDActions::Properties) { - KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), - i18n("Device monitor")); + new KPropertiesDialog(KURL(TQString("media:/%1").arg(sdevice->deviceNode()))); + } + else + { + TQString opType = TQString::null; + if (actionType == SDActions::Mount) { opType = "-m"; } + else if (actionType == SDActions::Unmount) { opType = "-u"; } + else if (actionType == SDActions::Unlock) { opType = "-k"; } + else if (actionType == SDActions::Lock) { opType = "-l"; } + else if (actionType == SDActions::Eject) { opType = "-e"; } + else if (actionType == SDActions::SafeRemove) { opType = "-s"; } + + if (!opType.isEmpty()) + { + TDEProcess proc; + proc << "tdeio_media_mounthelper" << opType << sdevice->deviceNode(); + if (!proc.start(TDEProcess::DontCare)) + { + KMessageBox::error(this, i18n("Could not start tdeio_media_mounthelper process."), + i18n("Device monitor")); + } + } } - } - } - } -} - -void HwDeviceSystemTray::slotPropertiesDevice(int parameter) -{ - TQString uuid = m_propertiesMenuIndexMap[parameter]; - if (!uuid.isEmpty()) - { - TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); - TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); - for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) - { - TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(hwdevice); - if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) - { - new KPropertiesDialog(KURL(TQString("media:/%1").arg(sdevice->deviceNode()))); - return; } } } @@ -642,8 +630,8 @@ void HwDeviceSystemTray::doDiskNotifications(bool scanOnly) // Scan devices for changes and notify new devices if needed. // This is necessary because the device information may not be available // at the time the hardwareAdded signal is emitted - TQMap<TQString, KnownDiskDeviceInfo> oldKnownDevices = m_knownDiskDevices; - m_knownDiskDevices.clear(); + TQMap<TQString, KnownDiskDeviceInfo> oldKnownDevices = d->m_knownDiskDevices; + d->m_knownDiskDevices.clear(); TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); TDEGenericHardwareList diskDeviceList = hwdevices->listByDeviceClass(TDEGenericDeviceType::Disk); for (TDEGenericDevice *hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) @@ -654,22 +642,17 @@ void HwDeviceSystemTray::doDiskNotifications(bool scanOnly) TQString sysPath = sdevice->systemPath(); if (oldKnownDevices.contains(sysPath)) { - m_knownDiskDevices[sysPath] = oldKnownDevices[sysPath]; + d->m_knownDiskDevices[sysPath] = oldKnownDevices[sysPath]; oldKnownDevices.remove(sysPath); } else { - TQString friendlyName = sdevice->diskLabel(); - if (friendlyName.isEmpty()) - { - friendlyName = sdevice->friendlyName(); - } - m_knownDiskDevices[sysPath] = { friendlyName, sdevice->deviceNode() }; + TQString deviceLabel = getDeviceLabel(sdevice); + d->m_knownDiskDevices[sysPath] = { deviceLabel, sdevice->deviceNode() }; if (!scanOnly && popupEnable) { - m_hardwareNotifierContainer->displayMessage( - i18n("A disk device has been added!"), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode()), + d->m_hardwareNotifierContainer->displayMessage( + i18n("A disk device has been added!"), deviceLabel, SmallIcon("drive-harddisk-unmounted"), 0, 0, "ADD: " + sysPath); } } @@ -681,9 +664,8 @@ void HwDeviceSystemTray::doDiskNotifications(bool scanOnly) TQMap<TQString, KnownDiskDeviceInfo>::ConstIterator delIt; for (delIt = oldKnownDevices.begin(); delIt != oldKnownDevices.end(); delIt++) { - m_hardwareNotifierContainer->displayMessage( - i18n("A disk device has been removed!"), - i18n("%1 (%2)").arg(delIt.data().friendlyName, delIt.data().node), + d->m_hardwareNotifierContainer->displayMessage( + i18n("A disk device has been removed!"), delIt.data().deviceLabel, SmallIcon("drive-harddisk-unmounted"), 0, 0, "REMOVE: " + delIt.key()); } } @@ -697,21 +679,16 @@ void HwDeviceSystemTray::deviceAdded(TDEGenericDevice* device) // The device information may not be available at the time the hardwareAdded signal is emitted. // In such case ignore the event and handle that at the subsequent hardwareUpdate signal emission. TQString sysPath = sdevice->systemPath(); - if (isMonitoredDevice(sdevice) && !m_knownDiskDevices.contains(sysPath)) + if (isMonitoredDevice(sdevice) && !d->m_knownDiskDevices.contains(sysPath)) { - TQString friendlyName = sdevice->diskLabel(); - if (friendlyName.isEmpty()) - { - friendlyName = sdevice->friendlyName(); - } - m_knownDiskDevices[sysPath] = { friendlyName, sdevice->deviceNode() }; + TQString deviceLabel = getDeviceLabel(sdevice); + d->m_knownDiskDevices[sysPath] = { deviceLabel, sdevice->deviceNode() }; TDEConfig config("mediamanagerrc"); config.setGroup("Global"); if (config.readBoolEntry("DeviceMonitorPopupsEnabled", true)) { - m_hardwareNotifierContainer->displayMessage( - i18n("A disk device has been added!"), - i18n("%1 (%2)").arg(friendlyName, sdevice->deviceNode()), + d->m_hardwareNotifierContainer->displayMessage( + i18n("A disk device has been added!"), deviceLabel, SmallIcon("drive-harddisk-unmounted"), 0, 0, "ADD: " + sysPath); } } @@ -724,18 +701,18 @@ void HwDeviceSystemTray::deviceRemoved(TDEGenericDevice* device) { TDEStorageDevice *sdevice = static_cast<TDEStorageDevice*>(device); TQString sysPath = sdevice->systemPath(); - if (isMonitoredDevice(sdevice) && m_knownDiskDevices.contains(sysPath)) + if (isMonitoredDevice(sdevice) && d->m_knownDiskDevices.contains(sysPath)) { TDEConfig config("mediamanagerrc"); config.setGroup("Global"); if (config.readBoolEntry("DeviceMonitorPopupsEnabled", true)) { - m_hardwareNotifierContainer->displayMessage( - i18n("A disk device has been removed!"), - i18n("%1 (%2)").arg(m_knownDiskDevices[sysPath].friendlyName, m_knownDiskDevices[sysPath].node), + TQString deviceLabel = getDeviceLabel(sdevice); + d->m_hardwareNotifierContainer->displayMessage( + i18n("A disk device has been removed!"), deviceLabel, SmallIcon("drive-harddisk-unmounted"), 0, 0, "REMOVE: " + sysPath); } - m_knownDiskDevices.remove(sysPath); + d->m_knownDiskDevices.remove(sysPath); } } } @@ -748,6 +725,13 @@ void HwDeviceSystemTray::deviceChanged(TDEGenericDevice* device) void HwDeviceSystemTray::devicePopupClicked(KPassivePopup* popup, TQPoint point, TQString uuid) { TDEGenericDevice *hwdevice; if (uuid.startsWith("ADD: ")) { + TDEConfig config("mediamanagerrc"); + config.setGroup("Global"); + if (config.readBoolEntry("NotificationPopupsEnabled", true)) + { + return; + } + uuid = uuid.right(uuid.length() - strlen("ADD: ")); if (uuid != "") { TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -776,7 +760,7 @@ void HwDeviceSystemTray::devicePopupClicked(KPassivePopup* popup, TQPoint point, } void HwDeviceSystemTray::slotHelpContents() { - kapp->invokeHelp(TQString::null, "hwdevicetray"); + tdeApp->invokeHelp(TQString::null, "hwdevicetray"); } #include "hwdevicetray.moc" |