rewrite formtatter* and customkeys* to share their code

This commit is contained in:
2017-07-12 03:28:03 +03:00
parent 7ce3e8b1cf
commit 9d0a1bd70c
21 changed files with 595 additions and 712 deletions

View File

@ -20,6 +20,7 @@
#include <KI18n/KLocalizedString>
#include <QDir>
#include <QFileInfo>
#include <QInputDialog>
#include <QPushButton>
@ -33,6 +34,15 @@ AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *_parent,
{
qCDebug(LOG_LIB) << __PRETTY_FUNCTION__;
// create directory at $HOME
QString localDir = QString("%1/awesomewidgets/%2")
.arg(QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation))
.arg(type());
QDir localDirectory;
if (localDirectory.mkpath(localDir))
qCInfo(LOG_LIB) << "Created directory" << localDir;
ui->setupUi(this);
copyButton
= ui->buttonBox->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
@ -182,6 +192,17 @@ QVariant AbstractExtItemAggregator::configArgs() const
}
QStringList AbstractExtItemAggregator::directories() const
{
auto dirs
= QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/%1").arg(type()),
QStandardPaths::LocateDirectory);
return dirs;
}
QString AbstractExtItemAggregator::type() const
{
return m_type;