Move showColumnsContextMenu function from kpmcore to partitionmanager.
This commit is contained in:
parent
95a74c63d1
commit
0c33a7b001
|
@ -25,12 +25,6 @@
|
||||||
#include <KAboutData>
|
#include <KAboutData>
|
||||||
#include <KLocalizedString>
|
#include <KLocalizedString>
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QHeaderView>
|
|
||||||
#include <QRect>
|
|
||||||
#include <QTreeWidget>
|
|
||||||
|
|
||||||
void registerMetaTypes()
|
void registerMetaTypes()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<Operation*>("Operation*");
|
qRegisterMetaType<Operation*>("Operation*");
|
||||||
|
@ -42,33 +36,6 @@ bool caseInsensitiveLessThan(const QString& s1, const QString& s2)
|
||||||
return s1.toLower() < s2.toLower();
|
return s1.toLower() < s2.toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
void showColumnsContextMenu(const QPoint& p, QTreeWidget& tree)
|
|
||||||
{
|
|
||||||
QMenu headerMenu(xi18nc("@title:menu", "Columns"));
|
|
||||||
|
|
||||||
QHeaderView* header = tree.header();
|
|
||||||
|
|
||||||
for (qint32 i = 0; i < tree.model()->columnCount(); i++) {
|
|
||||||
const int idx = header->logicalIndex(i);
|
|
||||||
const QString text = tree.model()->headerData(idx, Qt::Horizontal).toString();
|
|
||||||
|
|
||||||
QAction* action = headerMenu.addAction(text);
|
|
||||||
action->setCheckable(true);
|
|
||||||
action->setChecked(!header->isSectionHidden(idx));
|
|
||||||
action->setData(idx);
|
|
||||||
action->setEnabled(idx > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
QAction* action = headerMenu.exec(tree.header()->mapToGlobal(p));
|
|
||||||
|
|
||||||
if (action != nullptr) {
|
|
||||||
const bool hidden = !action->isChecked();
|
|
||||||
tree.setColumnHidden(action->data().toInt(), hidden);
|
|
||||||
if (!hidden)
|
|
||||||
tree.resizeColumnToContents(action->data().toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isMounted(const QString& deviceNode)
|
bool isMounted(const QString& deviceNode)
|
||||||
{
|
{
|
||||||
ExternalCommand cmd(QStringLiteral("lsblk"),
|
ExternalCommand cmd(QStringLiteral("lsblk"),
|
||||||
|
|
|
@ -29,19 +29,11 @@ class KAboutData;
|
||||||
|
|
||||||
class Partition;
|
class Partition;
|
||||||
class QString;
|
class QString;
|
||||||
class QPoint;
|
|
||||||
class QTreeWidget;
|
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT void registerMetaTypes();
|
LIBKPMCORE_EXPORT void registerMetaTypes();
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT bool caseInsensitiveLessThan(const QString& s1, const QString& s2);
|
LIBKPMCORE_EXPORT bool caseInsensitiveLessThan(const QString& s1, const QString& s2);
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT void showColumnsContextMenu(const QPoint& p, QTreeWidget& tree);
|
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT bool checkAccessibleDevices();
|
LIBKPMCORE_EXPORT bool checkAccessibleDevices();
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT bool isMounted(const QString& deviceNode);
|
LIBKPMCORE_EXPORT bool isMounted(const QString& deviceNode);
|
||||||
|
|
||||||
LIBKPMCORE_EXPORT KAboutData aboutKPMcore();
|
LIBKPMCORE_EXPORT KAboutData aboutKPMcore();
|
||||||
|
|
||||||
/** Pointer to the file system (which might be inside LUKS container) contained in the partition
|
/** Pointer to the file system (which might be inside LUKS container) contained in the partition
|
||||||
|
|
Loading…
Reference in New Issue