mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-15 22:59:57 +00:00
some part of refactoring
move plugin from private fix translation issue (#50)
This commit is contained in:
@ -19,7 +19,7 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -18,7 +18,7 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -22,7 +22,7 @@ import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
import "."
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import org.kde.plasma.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
|
@ -1,4 +1,5 @@
|
||||
set (PLUGIN_NAME awplugin)
|
||||
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
@ -24,24 +25,23 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
# task source is required by extscripts
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||
../../extsysmon/extquotes.cpp
|
||||
../../extsysmon/extscript.cpp
|
||||
../../extsysmon/extupgrade.cpp)
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
set (SUBPROJECT_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
set (SUBPROJECT_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_cpp (SUBPROJECT_MOC_SOURCE ${SUBPROJECT_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${SUBPROJECT_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_DESKTOP} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
|
@ -199,7 +199,7 @@ void AWActions::sendNotification(const QString eventId, const QString message, c
|
||||
{
|
||||
if ((eventId == QString("event")) && (!enablePopup)) return;
|
||||
|
||||
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: ") + eventId, message);
|
||||
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: %1").arg(eventId), message);
|
||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget"));
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class AWActions : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AWActions(QObject *parent = 0);
|
||||
AWActions(QObject *parent = nullptr);
|
||||
~AWActions();
|
||||
|
||||
Q_INVOKABLE void checkUpdates();
|
||||
@ -39,14 +39,15 @@ public:
|
||||
Q_INVOKABLE void sendEmail();
|
||||
Q_INVOKABLE void showReadme();
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
||||
// dataengine
|
||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, const bool enablePopup = false);
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
||||
const bool enablePopup = false);
|
||||
|
||||
private slots:
|
||||
void showUpdates(QString version);
|
||||
|
@ -43,7 +43,7 @@ static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scr
|
||||
|
||||
void AWPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget"));
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.awesomewidget"));
|
||||
|
||||
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
|
||||
class QQmlEngine;
|
||||
|
||||
class AWPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -135,10 +135,10 @@ QString AWKeys::parsePattern()
|
||||
QString parsed = pattern;
|
||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||
for (int i=0; i<foundKeys.count(); i++)
|
||||
parsed.replace(QString("$") + foundKeys[i], valueByKey(foundKeys[i]));
|
||||
parsed.replace(QString("$%1").arg(foundKeys[i]), valueByKey(foundKeys[i]));
|
||||
parsed.replace(QString(" "), QString(" "));
|
||||
for (int i=0; i<foundBars.count(); i++)
|
||||
parsed.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->image(valueByKey(foundBars[i]).toFloat()));
|
||||
parsed.replace(QString("$%1").arg(foundBars[i]), getItemByTag(foundBars[i])->image(valueByKey(foundBars[i]).toFloat()));
|
||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||
|
||||
return parsed;
|
||||
@ -259,10 +259,8 @@ QStringList AWKeys::dictKeys()
|
||||
allKeys.append(QString("hddw%1").arg(i));
|
||||
}
|
||||
// hdd temp
|
||||
for (int i=hddDevices.count()-1; i>=0; i--) {
|
||||
for (int i=hddDevices.count()-1; i>=0; i--)
|
||||
allKeys.append(QString("hddtemp%1").arg(i));
|
||||
allKeys.append(QString("hddtemp%1").arg(i));
|
||||
}
|
||||
// network
|
||||
for (int i=networkDevices.count()-1; i>=0; i--) {
|
||||
allKeys.append(QString("down%1").arg(i));
|
||||
@ -308,7 +306,8 @@ QStringList AWKeys::dictKeys()
|
||||
// bars
|
||||
QStringList graphicalItemsKeys;
|
||||
for (int i=0; i<graphicalItems.count(); i++)
|
||||
graphicalItemsKeys.append(graphicalItems[i]->name() + graphicalItems[i]->bar());
|
||||
graphicalItemsKeys.append(QString("%1%2").arg(graphicalItems[i]->name())
|
||||
.arg(graphicalItems[i]->bar()));
|
||||
graphicalItemsKeys.sort();
|
||||
for (int i=graphicalItemsKeys.count()-1; i>=0; i--)
|
||||
allKeys.append(graphicalItemsKeys[i]);
|
||||
@ -666,7 +665,10 @@ QString AWKeys::infoByKey(QString key)
|
||||
|
||||
key.remove(QRegExp(QString("^bar[0-9]{1,}")));
|
||||
if (key.startsWith(QString("custom")))
|
||||
return QString("%1").arg(extScripts[key.remove(QString("custom")).toInt()]->executable());
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
if (extScripts[i]->tag() != key) continue;
|
||||
return extScripts[i]->executable();
|
||||
}
|
||||
else if (key.contains(QRegExp(QString("^hdd[rw]"))))
|
||||
return QString("%1").arg(diskDevices[key.remove(QRegExp(QString("hdd[rw]"))).toInt()]);
|
||||
else if (key.startsWith(QString("fan")))
|
||||
@ -678,11 +680,17 @@ QString AWKeys::infoByKey(QString key)
|
||||
else if (key.contains(QRegExp(QString("^(down|up)[0-9]"))))
|
||||
return QString("%1").arg(networkDevices[key.remove(QRegExp(QString("^(down|up)"))).toInt()]);
|
||||
else if (key.startsWith(QString("pkgcount")))
|
||||
return QString("%1").arg(extUpgrade[key.remove(QString("pkgcount")).toInt()]->executable());
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
if (extUpgrade[i]->tag() != key) continue;
|
||||
return extUpgrade[i]->executable();
|
||||
}
|
||||
else if ((key.startsWith(QString("ask"))) ||
|
||||
(key.startsWith(QString("bid"))) ||
|
||||
(key.startsWith(QString("price"))))
|
||||
return QString("%1").arg(extQuotes[key.remove(QRegExp(QString("^(ask|bid|price)"))).toInt()]->ticker());
|
||||
for (int i=0; i<extQuotes.count(); i++) {
|
||||
if (extQuotes[i]->number() != key.remove(QRegExp(QString("^(ask|bid|price)"))).toInt()) continue;
|
||||
return extQuotes[i]->ticker();
|
||||
}
|
||||
else if (key.startsWith(QString("temp")))
|
||||
return QString("%1").arg(tempDevices[key.remove(QString("temp")).toInt()]);
|
||||
|
||||
@ -761,7 +769,8 @@ void AWKeys::loadKeysFromCache()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QString("%1/awesomewidgets.ndx").arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||
QString fileName = QString("%1/awesomewidgets.ndx")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cache file" << fileName;
|
||||
QSettings cache(fileName, QSettings::IniFormat);
|
||||
QStringList cachedKeys;
|
||||
@ -870,7 +879,7 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
case RequestedExtQuotes:
|
||||
for (int i=0; i<extQuotes.count(); i++) {
|
||||
if (extQuotes[i]->fileName() != current) continue;
|
||||
if (extQuotes[i]->tryDelete() == 1) {
|
||||
if (extQuotes[i]->tryDelete()) {
|
||||
widgetDialog->takeItem(widgetDialog->row(item));
|
||||
extQuotes.clear();
|
||||
extQuotes = getExtQuotes();
|
||||
@ -881,7 +890,7 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
case RequestedExtScript:
|
||||
for (int i=0; i<extScripts.count(); i++) {
|
||||
if (extScripts[i]->fileName() != current) continue;
|
||||
if (extScripts[i]->tryDelete() == 1) {
|
||||
if (extScripts[i]->tryDelete()) {
|
||||
widgetDialog->takeItem(widgetDialog->row(item));
|
||||
extScripts.clear();
|
||||
extScripts = getExtScripts();
|
||||
@ -892,7 +901,7 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
case RequestedExtUpgrade:
|
||||
for (int i=0; i<extUpgrade.count(); i++) {
|
||||
if (extUpgrade[i]->fileName() != current) continue;
|
||||
if (extUpgrade[i]->tryDelete() == 1) {
|
||||
if (extUpgrade[i]->tryDelete()) {
|
||||
widgetDialog->takeItem(widgetDialog->row(item));
|
||||
extUpgrade.clear();
|
||||
extUpgrade = getExtUpgrade();
|
||||
@ -903,7 +912,7 @@ void AWKeys::editItemButtonPressed(QAbstractButton *button)
|
||||
case RequestedGraphicalItem:
|
||||
for (int i=0; i<graphicalItems.count(); i++) {
|
||||
if (graphicalItems[i]->fileName() != current) continue;
|
||||
if (graphicalItems[i]->tryDelete() == 1) {
|
||||
if (graphicalItems[i]->tryDelete()) {
|
||||
widgetDialog->takeItem(widgetDialog->row(item));
|
||||
graphicalItems.clear();
|
||||
graphicalItems = getGraphicalItems();
|
||||
@ -1309,7 +1318,7 @@ QStringList AWKeys::findGraphicalItems()
|
||||
|
||||
QStringList selectedKeys;
|
||||
for (int i=orderedKeys.count()-1; i>=0; i--)
|
||||
if (pattern.contains(QString("$") + orderedKeys[i])) {
|
||||
if (pattern.contains(QString("$%1").arg(orderedKeys[i]))) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found key" << orderedKeys[i];
|
||||
selectedKeys.append(orderedKeys[i]);
|
||||
}
|
||||
@ -1323,7 +1332,7 @@ QStringList AWKeys::findKeys()
|
||||
QStringList selectedKeys;
|
||||
for (int i=0; i<keys.count(); i++) {
|
||||
if (keys[i].startsWith(QString("bar"))) continue;
|
||||
if (pattern.contains(QString("$") + keys[i])) {
|
||||
if (pattern.contains(QString("$%1").arg(keys[i]))) {
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Found key" << keys[i];
|
||||
selectedKeys.append(keys[i]);
|
||||
}
|
||||
@ -1339,8 +1348,8 @@ QList<ExtQuotes *> AWKeys::getExtQuotes()
|
||||
|
||||
QList<ExtQuotes *> externalQuotes;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/quotes");
|
||||
QString localDir = QString("%1/awesomewidgets/quotes")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
@ -1370,8 +1379,8 @@ QList<ExtScript *> AWKeys::getExtScripts()
|
||||
|
||||
QList<ExtScript *> externalScripts;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/scripts");
|
||||
QString localDir = QString("%1/awesomewidgets/scripts")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
@ -1401,8 +1410,8 @@ QList<ExtUpgrade *> AWKeys::getExtUpgrade()
|
||||
|
||||
QList<ExtUpgrade *> externalUpgrade;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/upgrade");
|
||||
QString localDir = QString("%1/awesomewidgets/upgrade")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
@ -1432,8 +1441,8 @@ QList<GraphicalItem *> AWKeys::getGraphicalItems()
|
||||
|
||||
QList<GraphicalItem *> items;
|
||||
// create directory at $HOME
|
||||
QString localDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/desktops");
|
||||
QString localDir = QString("%1/awesomewidgets/desktops")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if (localDirectory.mkpath(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
@ -48,7 +48,7 @@ class AWKeys : public QObject
|
||||
};
|
||||
|
||||
public:
|
||||
AWKeys(QObject *parent = 0);
|
||||
AWKeys(QObject *parent = nullptr);
|
||||
~AWKeys();
|
||||
|
||||
Q_INVOKABLE void initKeys(const QString currentPattern,
|
||||
|
@ -104,7 +104,7 @@ QPixmap AWToolTip::image()
|
||||
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||
if (requiredKeys[i] != QString("batTooltip"))
|
||||
pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
|
||||
pen.setColor(QColor(configuration[QString("%1Color").arg(requiredKeys[i])].toString()));
|
||||
float shift = i * 100.0;
|
||||
if (down) shift -= 100.0;
|
||||
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
||||
|
@ -32,7 +32,7 @@ class AWToolTip : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AWToolTip(QObject *parent = 0,
|
||||
AWToolTip(QObject *parent = nullptr,
|
||||
QMap<QString, QVariant> settings = QMap<QString, QVariant>());
|
||||
~AWToolTip();
|
||||
|
||||
|
@ -396,7 +396,7 @@ void GraphicalItem::readConfiguration()
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(m_dirs[i] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
@ -449,18 +449,18 @@ int GraphicalItem::showConfiguration(const QStringList tags)
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::tryDelete()
|
||||
bool GraphicalItem::tryDelete()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << m_dirs[i] + QDir::separator() + m_fileName <<
|
||||
QFile::remove(m_dirs[i] + QDir::separator() + m_fileName);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(m_dirs[i] + QDir::separator() + m_fileName)) return 0;
|
||||
return 1;
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -468,7 +468,7 @@ void GraphicalItem::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(m_dirs[0] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
@ -493,7 +493,7 @@ void GraphicalItem::changeColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QColor color = stringToColor(((QPushButton *)sender())->text());
|
||||
QColor color = stringToColor((dynamic_cast<QPushButton *>(sender()))->text());
|
||||
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||
QColorDialog::ShowAlphaChannel);
|
||||
if (!newColor.isValid()) return;
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
Circle
|
||||
};
|
||||
|
||||
explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(),
|
||||
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~GraphicalItem();
|
||||
QString fileName();
|
||||
@ -86,7 +86,7 @@ public:
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QStringList tags = QStringList());
|
||||
int tryDelete();
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
|
||||
private slots:
|
||||
|
@ -1,3 +1,3 @@
|
||||
module org.kde.plasma.private.awesomewidget
|
||||
module org.kde.plasma.awesomewidget
|
||||
|
||||
plugin awplugin
|
||||
|
Reference in New Issue
Block a user