Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit fee6cea4 authored by Laurent Montel's avatar Laurent Montel 😁

Remove KShortcut

parent d7fd7e14
......@@ -363,7 +363,7 @@ void BasicTab::setEntryInfo(MenuEntryInfo *entryInfo)
if( KHotKeys::present())
{
if ( !entryInfo->shortcut().isEmpty() )
_keyBindingEdit->setKeySequence( entryInfo->shortcut().primary() );
_keyBindingEdit->setKeySequence( entryInfo->shortcut() );
else
_keyBindingEdit->clearKeySequence();
}
......@@ -498,7 +498,7 @@ void BasicTab::slotCapturedKeySequence(const QKeySequence& seq)
{
if (signalsBlocked())
return;
KShortcut cut(seq, QKeySequence());
QKeySequence cut(seq);
#ifdef WITH_HOTKEYS
if (_menuEntryInfo->isShortcutAvailable( cut ) && KHotKeys::present() )
{
......
......@@ -21,7 +21,7 @@
#define basictab_h
#include <QTabWidget>
#include <KShortcut>
#include <QKeySequence>
#include <KService>
class KKeySequenceWidget;
......@@ -51,7 +51,7 @@ public:
Q_SIGNALS:
void changed( MenuFolderInfo * );
void changed( MenuEntryInfo * );
void findServiceShortcut(const KShortcut&, KService::Ptr &);
void findServiceShortcut(const QKeySequence&, KService::Ptr &);
public Q_SLOTS:
void setFolderInfo(MenuFolderInfo *folderInfo);
......
......@@ -40,11 +40,7 @@
#include "configurationmanager.h"
KMenuEdit::KMenuEdit ()
: KXmlGuiWindow (0)
, m_tree(0)
, m_basicTab(0)
, m_splitter(0)
, m_actionDelete(0)
: KXmlGuiWindow (nullptr)
{
// dbus
( void )new KmenueditAdaptor(this);
......
......@@ -58,7 +58,7 @@ protected:
QSplitter *m_splitter = nullptr;
QAction *m_actionDelete = nullptr;
bool m_showHidden;
bool m_showHidden = false;
};
#endif
......@@ -39,10 +39,16 @@ static QStringList *s_freeShortcuts = nullptr;
static QStringList *s_deletedApps = nullptr;
// Add separator
MenuFolderInfo::~MenuFolderInfo()
{
qDeleteAll(subFolders);
subFolders.clear();
}
void MenuFolderInfo::add(MenuSeparatorInfo *info, bool initial)
{
if (initial)
initialLayout.append(info);
if (initial)
initialLayout.append(info);
}
// Add sub menu
......@@ -248,7 +254,7 @@ bool MenuFolderInfo::hasDirt()
return false;
}
KService::Ptr MenuFolderInfo::findServiceShortcut(const KShortcut&cut)
KService::Ptr MenuFolderInfo::findServiceShortcut(const QKeySequence&cut)
{
KService::Ptr result;
// Check sub-menus
......@@ -370,7 +376,7 @@ void MenuEntryInfo::setIcon(const QString &_icon)
desktopFile()->desktopGroup().writeEntry("Icon", icon);
}
KShortcut MenuEntryInfo::shortcut()
QKeySequence MenuEntryInfo::shortcut()
{
#ifdef WITH_HOTKEYS
if (!shortcutLoaded)
......@@ -378,14 +384,14 @@ KShortcut MenuEntryInfo::shortcut()
shortcutLoaded = true;
if( KHotKeys::present())
{
shortCut = KShortcut(KHotKeys::getMenuEntryShortcut( service->storageId() ));
shortCut = QKeySequence(KHotKeys::getMenuEntryShortcut( service->storageId() ));
}
}
#endif
return shortCut;
}
static void freeShortcut(const KShortcut &shortCut)
static void freeShortcut(const QKeySequence &shortCut)
{
if (!shortCut.isEmpty())
{
......@@ -400,7 +406,7 @@ static void freeShortcut(const KShortcut &shortCut)
}
}
static void allocateShortcut(const KShortcut &shortCut)
static void allocateShortcut(const QKeySequence &shortCut)
{
if (!shortCut.isEmpty())
{
......@@ -415,7 +421,7 @@ static void allocateShortcut(const KShortcut &shortCut)
}
}
void MenuEntryInfo::setShortcut(const KShortcut &_shortcut)
void MenuEntryInfo::setShortcut(const QKeySequence &_shortcut)
{
if (shortCut == _shortcut)
return;
......@@ -425,7 +431,7 @@ void MenuEntryInfo::setShortcut(const KShortcut &_shortcut)
shortCut = _shortcut;
if (shortCut.isEmpty())
shortCut = KShortcut(); // Normalize
shortCut = QKeySequence(); // Normalize
shortcutLoaded = true;
shortcutDirty = true;
......@@ -435,8 +441,8 @@ void MenuEntryInfo::setInUse(bool inUse)
{
if (inUse)
{
KShortcut temp = shortcut();
shortCut = KShortcut();
QKeySequence temp = shortcut();
shortCut = QKeySequence();
if (isShortcutAvailable(temp))
shortCut = temp;
else
......@@ -458,7 +464,7 @@ void MenuEntryInfo::setInUse(bool inUse)
}
}
bool MenuEntryInfo::isShortcutAvailable(const KShortcut &_shortcut)
bool MenuEntryInfo::isShortcutAvailable(const QKeySequence &_shortcut)
{
// We only have to check agains not saved local shortcuts.
// KKeySequenceWidget checks against all other registered shortcuts.
......
......@@ -23,7 +23,7 @@
#include <QList>
#include <KShortcut>
#include <QKeySequence>
#include <KService>
class MenuFile;
......@@ -46,7 +46,7 @@ class MenuFolderInfo : public MenuInfo
{
public:
MenuFolderInfo() : dirty(false), hidden(false) { }
~MenuFolderInfo() { qDeleteAll(subFolders); subFolders.clear(); }
~MenuFolderInfo();
// Add separator
void add(MenuSeparatorInfo *, bool initial=false);
......@@ -120,7 +120,7 @@ public:
void save(MenuFile *);
// Search service by shortcut
KService::Ptr findServiceShortcut(const KShortcut&);
KService::Ptr findServiceShortcut(const QKeySequence&);
// Set whether the entry is in active use (as opposed to in the clipboard/deleted)
void setInUse(bool inUse);
......@@ -161,9 +161,9 @@ public:
QString file() const { return service->entryPath(); }
KShortcut shortcut();
void setShortcut(const KShortcut &_shortcut);
bool isShortcutAvailable(const KShortcut &_shortcut);
QKeySequence shortcut();
void setShortcut(const QKeySequence &_shortcut);
bool isShortcutAvailable(const QKeySequence &_shortcut);
void setDirty();
......@@ -183,7 +183,7 @@ public:
QString icon;
KService::Ptr service;
KDesktopFile *m_desktopFile;
KShortcut shortCut;
QKeySequence shortCut;
bool shortcutLoaded;
bool shortcutDirty;
bool dirty;
......
......@@ -291,6 +291,7 @@ TreeView::~TreeView()
cleanupClipboard();
delete m_rootFolder;
delete m_separator;
delete m_menuFile;
}
void TreeView::setViewMode(bool showHidden)
......@@ -692,7 +693,7 @@ void TreeView::currentDataChanged(MenuEntryInfo *entryInfo)
QString name;
if (m_detailedMenuEntries && entryInfo->description.length() != 0) {
if (m_detailedMenuEntries && !entryInfo->description.isEmpty()) {
if (m_detailedEntriesNamesFirst) {
name = entryInfo->caption + QStringLiteral(" (") + entryInfo->description + QLatin1Char(')');
} else {
......@@ -1883,7 +1884,7 @@ bool TreeView::dirty()
return m_layoutDirty || m_rootFolder->hasDirt() || m_menuFile->dirty() || isLayoutDirty();
}
void TreeView::findServiceShortcut(const KShortcut&cut, KService::Ptr &service)
void TreeView::findServiceShortcut(const QKeySequence&cut, KService::Ptr &service)
{
service = m_rootFolder->findServiceShortcut(cut);
}
......
......@@ -39,7 +39,7 @@ class MenuFile;
class MenuFolderInfo;
class MenuEntryInfo;
class MenuSeparatorInfo;
class KShortcut;
class QKeySequence;
static const QString SAVE_ACTION_NAME = QStringLiteral("file_save");
static const QString NEW_ITEM_ACTION_NAME = QStringLiteral("new_item");
......@@ -134,7 +134,7 @@ public:
public Q_SLOTS:
void currentDataChanged(MenuFolderInfo *folderInfo);
void currentDataChanged(MenuEntryInfo *entryInfo);
void findServiceShortcut(const KShortcut&, KService::Ptr &);
void findServiceShortcut(const QKeySequence&, KService::Ptr &);
Q_SIGNALS:
void entrySelected(MenuFolderInfo *folderInfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment