Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Jan 31, 2019
1 parent 74c2b58 commit 755bc9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ Current codebase is fork from [dde-dock#39c1a6b](https://github.com/linuxdeepin/

### Usage

You need do `apt build-dep dde-dock` first.

You also need to install `dde-dock-dev` package: `apt install dde-dock-dev` .
We assume you already enabled a `deb-src` source in your `/etc/apt/sources.list` thus you can use `apt build-dep <pkg-name>` to install build depts. Then you need do `apt build-dep dde-dock` first, and install `dde-dock-dev` package by doing `apt install dde-dock-dev`. Of course you can also install the build depts manually if you like.

To compile and run:

Expand Down
8 changes: 5 additions & 3 deletions datetimeplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <QLabel>
#include <QDebug>

#define PLUGIN_STATE_KEY "enable"

DatetimePlugin::DatetimePlugin(QObject *parent)
: QObject(parent),

Expand Down Expand Up @@ -70,9 +72,9 @@ void DatetimePlugin::init(PluginProxyInterface *proxyInter)

void DatetimePlugin::pluginStateSwitched()
{
m_centralWidget->setEnabled(!m_centralWidget->enabled());
m_proxyInter->saveValue(this, PLUGIN_STATE_KEY, pluginIsDisable());

if (m_centralWidget->enabled()) {
if (!pluginIsDisable()) {
m_proxyInter->itemAdded(this, pluginName());
} else {
m_proxyInter->itemRemoved(this, pluginName());
Expand All @@ -81,7 +83,7 @@ void DatetimePlugin::pluginStateSwitched()

bool DatetimePlugin::pluginIsDisable()
{
return !m_centralWidget->enabled();
return !(m_proxyInter->getValue(this, PLUGIN_STATE_KEY, true).toBool());
}

int DatetimePlugin::itemSortKey(const QString &itemKey)
Expand Down

0 comments on commit 755bc9d

Please sign in to comment.