mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-14 22:35:49 +00:00
fix cppcheck warnings
improvements of interaction with items
This commit is contained in:
@ -316,7 +316,7 @@ ExtScript::ScriptData ExtScript::run(const int time)
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::showConfiguration()
|
||||
int ExtScript::showConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -336,7 +336,7 @@ void ExtScript::showConfiguration()
|
||||
ui->spinBox_interval->setValue(m_interval);
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return;
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWESAPI);
|
||||
@ -348,16 +348,22 @@ void ExtScript::showConfiguration()
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::tryDelete()
|
||||
int ExtScript::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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,8 +81,8 @@ public:
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
ScriptData run(const int time);
|
||||
void showConfiguration();
|
||||
void tryDelete();
|
||||
int showConfiguration();
|
||||
int tryDelete();
|
||||
void writeConfiguration();
|
||||
|
||||
private:
|
||||
|
@ -105,11 +105,13 @@ QString ExtendedSysMon::getAutoMpris()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(QDBus::BlockWithGui, QString("ListNames"));
|
||||
QList<QVariant> arguments = listServices.arguments();
|
||||
if (listServices.arguments().count() == 0) return QString();
|
||||
QStringList arguments = listServices.arguments()[0].toStringList();
|
||||
|
||||
for (int i=0; i<arguments.count(); i++) {
|
||||
if (!arguments[i].toString().startsWith(QString("org.mpris.MediaPlayer2."))) continue;
|
||||
QString service = arguments[i].toString();
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Service found" << arguments[i];
|
||||
if (!arguments[i].startsWith(QString("org.mpris.MediaPlayer2."))) continue;
|
||||
QString service = arguments[i];
|
||||
service.remove(QString("org.mpris.MediaPlayer2."));
|
||||
return service;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ int ExtUpgrade::run()
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::showConfiguration()
|
||||
int ExtUpgrade::showConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -210,7 +210,7 @@ void ExtUpgrade::showConfiguration()
|
||||
ui->spinBox_null->setValue(m_null);
|
||||
|
||||
int ret = exec();
|
||||
if (ret != 1) return;
|
||||
if (ret != 1) return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setApiVersion(AWEUAPI);
|
||||
@ -219,16 +219,22 @@ void ExtUpgrade::showConfiguration()
|
||||
setNull(ui->spinBox_null->value());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::tryDelete()
|
||||
int ExtUpgrade::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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,8 +58,8 @@ public:
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int run();
|
||||
void showConfiguration();
|
||||
void tryDelete();
|
||||
int showConfiguration();
|
||||
int tryDelete();
|
||||
void writeConfiguration();
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user