mirror of
https://github.com/KDE/latte-dock.git
synced 2025-02-13 21:57:40 +03:00
support lock/unlock in layout
--identify if a layout is locked and support lock/unlock for that layout
This commit is contained in:
parent
b02628de3f
commit
1e2b996a9e
@ -220,6 +220,35 @@ void Layout::setShowInMenu(bool show)
|
||||
emit showInMenuChanged();
|
||||
}
|
||||
|
||||
bool Layout::isWritable() const
|
||||
{
|
||||
QFileInfo layoutFileInfo(m_layoutFile);
|
||||
|
||||
if (layoutFileInfo.exists() && !layoutFileInfo.isWritable()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Layout::lock()
|
||||
{
|
||||
QFileInfo layoutFileInfo(m_layoutFile);
|
||||
|
||||
if (layoutFileInfo.exists() && layoutFileInfo.isWritable()) {
|
||||
QFile(m_layoutFile).setPermissions(QFileDevice::ReadUser | QFileDevice::ReadGroup | QFileDevice::ReadOther);
|
||||
}
|
||||
}
|
||||
|
||||
void Layout::unlock()
|
||||
{
|
||||
QFileInfo layoutFileInfo(m_layoutFile);
|
||||
|
||||
if (layoutFileInfo.exists() && !layoutFileInfo.isWritable()) {
|
||||
QFile(m_layoutFile).setPermissions(QFileDevice::ReadUser | QFileDevice::WriteUser | QFileDevice::ReadGroup | QFileDevice::ReadOther);
|
||||
}
|
||||
}
|
||||
|
||||
QString Layout::background() const
|
||||
{
|
||||
return m_background;
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
//!it is original layout compared to pseudo-layouts that are combinations of multiple-original layouts
|
||||
bool isOriginalLayout() const;
|
||||
|
||||
bool isWritable() const;
|
||||
|
||||
int version() const;
|
||||
void setVersion(int ver);
|
||||
|
||||
@ -132,6 +134,11 @@ public:
|
||||
QList<Plasma::Types::Location> freeEdges(QScreen *screen) const;
|
||||
QList<Plasma::Types::Location> freeEdges(int screen) const;
|
||||
|
||||
//! make it only read-only
|
||||
void lock();
|
||||
//! make it writable which it should be the default
|
||||
void unlock();
|
||||
|
||||
int noDocksWithTasks() const;
|
||||
int docksCount() const;
|
||||
int docksCount(int screen) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user