Commit 1e853dd1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

run git clang-format

parent a421f74c
......@@ -14,17 +14,17 @@
#include <KContacts/VCardConverter>
#include <KLocalizedString>
#include <KConfig>
#include <KLocalizedString>
#include <KConfigGroup>
#include <QVBoxLayout>
#include <QLabel>
#include <QTabWidget>
#include <KSharedConfig>
#include <QDialogButtonBox>
#include <QLabel>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
ContactPrintThemeConfigureDialog::ContactPrintThemeConfigureDialog(QWidget *parent)
: QDialog(parent)
......
......@@ -9,15 +9,18 @@
#include <QDialog>
namespace GrantleeThemeEditor {
namespace GrantleeThemeEditor
{
class ConfigureWidget;
}
namespace Akonadi {
namespace Akonadi
{
class AkonadiContactEditor;
}
namespace KPIMTextEdit {
namespace KPIMTextEdit
{
class PlainTextEditorWidget;
}
class ContactPrintThemeConfigureDialog : public QDialog
......
......@@ -12,33 +12,35 @@ ContactPrintThemeEditorutil::ContactPrintThemeEditorutil()
QString ContactPrintThemeEditorutil::defaultContact() const
{
const QString contact = QStringLiteral("BEGIN:VCARD\n"
"ADR;TYPE=home:;;10 street Eiffel Tower\n;Paris;;75016;France\n"
"EMAIL:test@kde.org\n"
"FN:Test\n"
"N:Test;;;;\n"
"ORG:kde\n"
"TEL;TYPE=HOME:+33 12345678\n"
"UID:{851e0b81-8f95-40d2-a6a6-a9dbee2be12d}\n"
"URL:www.kde.org\n"
"VERSION:3.0\n"
"END:VCARD");
const QString contact = QStringLiteral(
"BEGIN:VCARD\n"
"ADR;TYPE=home:;;10 street Eiffel Tower\n;Paris;;75016;France\n"
"EMAIL:test@kde.org\n"
"FN:Test\n"
"N:Test;;;;\n"
"ORG:kde\n"
"TEL;TYPE=HOME:+33 12345678\n"
"UID:{851e0b81-8f95-40d2-a6a6-a9dbee2be12d}\n"
"URL:www.kde.org\n"
"VERSION:3.0\n"
"END:VCARD");
return contact;
}
QString ContactPrintThemeEditorutil::defaultTemplate() const
{
const QString templateStr = QStringLiteral("<html>\n"
"{% if contacts %}\n"
"{% for contact in contacts %}\n"
"<h1>{{ contact.realName|safe }}</h1>\n"
"<p>{{ contact.emails|safe }}</p>\n"
"<p>{{ contact.note|safe }}</p>\n"
"<br>\n"
"<br>\n"
"{% endfor %}\n"
"{% endif %}\n"
"</html>");
const QString templateStr = QStringLiteral(
"<html>\n"
"{% if contacts %}\n"
"{% for contact in contacts %}\n"
"<h1>{{ contact.realName|safe }}</h1>\n"
"<p>{{ contact.emails|safe }}</p>\n"
"<p>{{ contact.note|safe }}</p>\n"
"<br>\n"
"<br>\n"
"{% endfor %}\n"
"{% endif %}\n"
"</html>");
return templateStr;
}
......@@ -5,14 +5,14 @@
*/
#include "contactprintthemepreview.h"
#include "contactprintthemeeditor_debug.h"
#include "contactprintthemeeditorutil.h"
#include <KSharedConfig>
#include <Akonadi/Contact/GrantleePrint>
#include <KConfigGroup>
#include <KContacts/VCardConverter>
#include <KSharedConfig>
#include <QHBoxLayout>
#include <QWebEngineView>
#include <KContacts/VCardConverter>
#include <Akonadi/Contact/GrantleePrint>
#include "contactprintthemeeditor_debug.h"
ContactPrintThemePreview::ContactPrintThemePreview(const QString &projectDirectory, QWidget *parent)
: GrantleeThemeEditor::PreviewWidget(parent)
......
......@@ -8,10 +8,11 @@
#include <QWidget>
#include <KContacts/Addressee>
#include "grantleethemeeditor/previewwidget.h"
#include <KContacts/Addressee>
namespace KAddressBookGrantlee {
namespace KAddressBookGrantlee
{
}
class QWebEngineView;
......
......@@ -8,61 +8,24 @@
QStringList DefaultCompletion::defaultCompetion()
{
//TODO add to highlighter
// TODO add to highlighter
QStringList lst;
lst << QStringLiteral("<div>")
<< QStringLiteral("contact.birthdayi18n")
<< QStringLiteral("contact.anniversaryi18n")
<< QStringLiteral("contact.emailsi18n")
<< QStringLiteral("contact.websitei18n")
<< QStringLiteral("contact.blogUrli18n")
<< QStringLiteral("contact.addressBookNamei18n")
<< QStringLiteral("contact.notei18n")
<< QStringLiteral("contact.departmenti18n")
<< QStringLiteral("contact.Professioni18n")
<< QStringLiteral("contact.officei18n")
<< QStringLiteral("contact.manageri18n")
<< QStringLiteral("contact.assistanti18n")
<< QStringLiteral("contact.spousei18n")
<< QStringLiteral("contact.imAddressi18n")
<< QStringLiteral("contact.latitudei18n")
<< QStringLiteral("contact.longitudei18n")
<< QStringLiteral("contact.organizationi18n")
<< QStringLiteral("contact.titlei18n")
<< QStringLiteral("contact.nextcontacti18n")
<< QStringLiteral("contact.name")
<< QStringLiteral("contact.realName")
<< QStringLiteral("contact.formattedName")
<< QStringLiteral("contact.prefix")
<< QStringLiteral("contact.givenName")
<< QStringLiteral("contact.additionalName")
<< QStringLiteral("contact.familyName")
<< QStringLiteral("contact.suffix")
<< QStringLiteral("contact.nickName")
<< QStringLiteral("contact.emails")
<< QStringLiteral("contact.organization")
<< QStringLiteral("contact.note")
<< QStringLiteral("contact.webSite")
<< QStringLiteral("contact.title")
<< QStringLiteral("contact.preferredEmail")
<< QStringLiteral("contact.role")
<< QStringLiteral("contact.birthday")
<< QStringLiteral("contact.department")
<< QStringLiteral("contact.addresses")
<< QStringLiteral("contact.phones")
<< QStringLiteral("contact.addressBookName")
<< QStringLiteral("contact.instantManging")
<< QStringLiteral("contact.geo")
<< QStringLiteral("contact.photo")
<< QStringLiteral("contact.logo")
<< QStringLiteral("contact.crypto")
<< QStringLiteral("contact.anniversary")
<< QStringLiteral("contact.profession")
<< QStringLiteral("contact.office")
<< QStringLiteral("contact.manager")
<< QStringLiteral("contact.assistant")
<< QStringLiteral("contact.spouse")
<< QStringLiteral("contact.languages");
lst << QStringLiteral("<div>") << QStringLiteral("contact.birthdayi18n") << QStringLiteral("contact.anniversaryi18n")
<< QStringLiteral("contact.emailsi18n") << QStringLiteral("contact.websitei18n") << QStringLiteral("contact.blogUrli18n")
<< QStringLiteral("contact.addressBookNamei18n") << QStringLiteral("contact.notei18n") << QStringLiteral("contact.departmenti18n")
<< QStringLiteral("contact.Professioni18n") << QStringLiteral("contact.officei18n") << QStringLiteral("contact.manageri18n")
<< QStringLiteral("contact.assistanti18n") << QStringLiteral("contact.spousei18n") << QStringLiteral("contact.imAddressi18n")
<< QStringLiteral("contact.latitudei18n") << QStringLiteral("contact.longitudei18n") << QStringLiteral("contact.organizationi18n")
<< QStringLiteral("contact.titlei18n") << QStringLiteral("contact.nextcontacti18n") << QStringLiteral("contact.name")
<< QStringLiteral("contact.realName") << QStringLiteral("contact.formattedName") << QStringLiteral("contact.prefix")
<< QStringLiteral("contact.givenName") << QStringLiteral("contact.additionalName") << QStringLiteral("contact.familyName")
<< QStringLiteral("contact.suffix") << QStringLiteral("contact.nickName") << QStringLiteral("contact.emails") << QStringLiteral("contact.organization")
<< QStringLiteral("contact.note") << QStringLiteral("contact.webSite") << QStringLiteral("contact.title") << QStringLiteral("contact.preferredEmail")
<< QStringLiteral("contact.role") << QStringLiteral("contact.birthday") << QStringLiteral("contact.department") << QStringLiteral("contact.addresses")
<< QStringLiteral("contact.phones") << QStringLiteral("contact.addressBookName") << QStringLiteral("contact.instantManging")
<< QStringLiteral("contact.geo") << QStringLiteral("contact.photo") << QStringLiteral("contact.logo") << QStringLiteral("contact.crypto")
<< QStringLiteral("contact.anniversary") << QStringLiteral("contact.profession") << QStringLiteral("contact.office")
<< QStringLiteral("contact.manager") << QStringLiteral("contact.assistant") << QStringLiteral("contact.spouse") << QStringLiteral("contact.languages");
return lst;
}
......
......@@ -9,7 +9,8 @@
#include <QStringList>
namespace DefaultCompletion {
namespace DefaultCompletion
{
Q_REQUIRED_RESULT QStringList defaultCompetion();
Q_REQUIRED_RESULT QStringList defaultOptions();
}
......
......@@ -5,22 +5,22 @@
*/
#include "editorpage.h"
#include "KSplitterCollapserButton"
#include "contactprintthemeeditorutil.h"
#include "contactprintthemepreview.h"
#include "editorwidget.h"
#include "previewwidget.h"
#include "themeeditorwidget.h"
#include "themetemplatewidget.h"
#include "contactprintthemepreview.h"
#include "contactprintthemeeditorutil.h"
#include <KPIMTextEdit/PlainTextEditor>
#include "KSplitterCollapserButton"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
#include <QSplitter>
#include <QVBoxLayout>
#include <KSharedConfig>
EditorPage::EditorPage(GrantleeThemeEditor::EditorPage::PageType type, const QString &projectDirectory, QWidget *parent)
: GrantleeThemeEditor::EditorPage(type, parent)
......@@ -62,9 +62,7 @@ EditorPage::EditorPage(GrantleeThemeEditor::EditorPage::PageType type, const QSt
if (mType == MainPage) {
KConfigGroup group(KSharedConfig::openConfig(), "EditorPage");
const QList<int> size {
400, 100
};
const QList<int> size{400, 100};
mMainSplitter->setSizes(group.readEntry("mainSplitter", size));
mWidgetSplitter->setSizes(group.readEntry("widgetSplitter", size));
}
......
......@@ -13,7 +13,8 @@ class ThemeTemplateWidget;
class EditorWidget;
class QSplitter;
class ContactPrintThemePreview;
namespace GrantleeThemeEditor {
namespace GrantleeThemeEditor
{
class EditorWidget;
}
......
......@@ -6,13 +6,13 @@
#include "grantleeeditor-version.h"
#include "themeeditormainwindow.h"
#include <QApplication>
#include <KAboutData>
#include <KCrash>
#include <KDBusService>
#include <KLocalizedString>
#include <QApplication>
#include <QCommandLineParser>
#include <QIcon>
#include <KCrash>
int main(int argc, char **argv)
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
......
......@@ -10,7 +10,7 @@ QVector<PimCommon::defaultTemplate> ThemeDefaultTemplate::defaultTemplates()
{
QVector<PimCommon::defaultTemplate> lst;
PimCommon::defaultTemplate tmp;
//TODO
// TODO
return lst;
}
......@@ -9,7 +9,8 @@
#include <PimCommon/TemplateListWidget>
namespace ThemeDefaultTemplate {
namespace ThemeDefaultTemplate
{
Q_REQUIRED_RESULT QVector<PimCommon::defaultTemplate> defaultTemplates();
}
......
......@@ -5,26 +5,26 @@
*/
#include "themeeditormainwindow.h"
#include "themeeditorpage.h"
#include "newthemedialog.h"
#include "contactprintthemeconfiguredialog.h"
#include "managethemes.h"
#include "newthemedialog.h"
#include "themeeditorpage.h"
#include <KStandardAction>
#include <QAction>
#include <KActionCollection>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <QFileDialog>
#include <KRecentFilesAction>
#include <KConfigGroup>
#include <KStandardAction>
#include <QAction>
#include <QFileDialog>
#include <KAuthorized>
#include <KSharedConfig>
#include <QApplication>
#include <QPointer>
#include <QCloseEvent>
#include <KSharedConfig>
#include <QPointer>
#include <QStandardPaths>
#include <KAuthorized>
ThemeEditorMainWindow::ThemeEditorMainWindow()
: KXmlGuiWindow()
......@@ -149,7 +149,7 @@ void ThemeEditorMainWindow::slotConfigure()
void ThemeEditorMainWindow::slotInstallTheme()
{
//Save before installing :)
// Save before installing :)
if (slotSaveTheme()) {
const QString localThemePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/kaddressbook/printing/themes");
if (QDir().mkpath(localThemePath)) {
......@@ -160,7 +160,7 @@ void ThemeEditorMainWindow::slotInstallTheme()
void ThemeEditorMainWindow::slotUploadTheme()
{
//Save before upload :)
// Save before upload :)
if (slotSaveTheme()) {
mThemeEditor->uploadTheme();
}
......@@ -245,8 +245,7 @@ bool ThemeEditorMainWindow::saveCurrentProject(ActionSaveTheme act)
case SaveAndCloseTheme:
closeThemeEditor();
break;
case SaveAndCreateNewTheme:
{
case SaveAndCreateNewTheme: {
delete mThemeEditor;
mThemeEditor = nullptr;
QPointer<GrantleeThemeEditor::NewThemeDialog> dialog = new GrantleeThemeEditor::NewThemeDialog(this);
......
......@@ -44,11 +44,7 @@ private:
void slotSaveAsTheme();
private:
enum ActionSaveTheme {
SaveOnly = 0,
SaveAndCloseTheme,
SaveAndCreateNewTheme
};
enum ActionSaveTheme { SaveOnly = 0, SaveAndCloseTheme, SaveAndCreateNewTheme };
Q_REQUIRED_RESULT bool loadTheme(const QString &directory);
void writeConfig();
......
......@@ -5,27 +5,27 @@
*/
#include "themeeditorpage.h"
#include "contactprintthemepreview.h"
#include "desktopfilepage.h"
#include "editorpage.h"
#include "themeeditortabwidget.h"
#include "themeeditorwidget.h"
#include "themesession.h"
#include "themeeditortabwidget.h"
#include "contactprintthemepreview.h"
#include <kns3/uploaddialog.h>
#include "contactprintthemeeditor_debug.h"
#include <KLocalizedString>
#include <QInputDialog>
#include <KMessageBox>
#include <KZip>
#include <QInputDialog>
#include <QTemporaryDir>
#include "contactprintthemeeditor_debug.h"
#include <KMessageBox>
#include <QUrl>
#include <QHBoxLayout>
#include <QDir>
#include <QPointer>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QPointer>
ThemeEditorPage::ThemeEditorPage(const QString &projectDir, const QString &themeName, QWidget *parent)
: QWidget(parent)
......@@ -47,8 +47,14 @@ ThemeEditorPage::ThemeEditorPage(const QString &projectDir, const QString &theme
mDesktopPage->setThemeName(themeName);
mTabWidget->addTab(mDesktopPage, i18n("Desktop File"));
connect(mDesktopPage, &GrantleeThemeEditor::DesktopFilePage::mainFileNameChanged, mEditorPage->preview(), &GrantleeThemeEditor::PreviewWidget::slotMainFileNameChanged);
connect(mDesktopPage, &GrantleeThemeEditor::DesktopFilePage::mainFileNameChanged, mTabWidget, &GrantleeThemeEditor::ThemeEditorTabWidget::slotMainFileNameChanged);
connect(mDesktopPage,
&GrantleeThemeEditor::DesktopFilePage::mainFileNameChanged,
mEditorPage->preview(),
&GrantleeThemeEditor::PreviewWidget::slotMainFileNameChanged);
connect(mDesktopPage,
&GrantleeThemeEditor::DesktopFilePage::mainFileNameChanged,
mTabWidget,
&GrantleeThemeEditor::ThemeEditorTabWidget::slotMainFileNameChanged);
connect(mDesktopPage, &GrantleeThemeEditor::DesktopFilePage::changed, this, &ThemeEditorPage::slotChanged);
connect(mTabWidget, &GrantleeThemeEditor::ThemeEditorTabWidget::tabCloseRequested, this, &ThemeEditorPage::slotCloseTab);
}
......@@ -146,7 +152,7 @@ void ThemeEditorPage::installTheme(const QString &themePath)
void ThemeEditorPage::uploadTheme()
{
//force update for screenshot
// force update for screenshot
mEditorPage->preview()->updateViewer();
QTemporaryDir tmp;
const QString themename = mDesktopPage->themeName();
......@@ -154,7 +160,7 @@ void ThemeEditorPage::uploadTheme()
KZip *zip = new KZip(zipFileName);
if (zip->open(QIODevice::WriteOnly)) {
const QString previewFileName = tmp.path() + QLatin1Char('/') + themename + QLatin1String("_preview.png");
//qCDebug(CONTACTPRINTTHEMEEDITOR_LOG)<<" previewFileName"<<previewFileName;
// qCDebug(CONTACTPRINTTHEMEEDITOR_LOG)<<" previewFileName"<<previewFileName;
QStringList lst;
lst << previewFileName;
mEditorPage->preview()->createScreenShot(lst);
......@@ -168,7 +174,7 @@ void ThemeEditorPage::uploadTheme()
createZip(themename, zip);
zip->close();
//qCDebug(CONTACTPRINTTHEMEEDITOR_LOG)<< "zipFilename"<<zipFileName;
// qCDebug(CONTACTPRINTTHEMEEDITOR_LOG)<< "zipFilename"<<zipFileName;
QPointer<KNS3::UploadDialog> dialog = new KNS3::UploadDialog(QStringLiteral("messageviewer_header_themes.knsrc"), this);
dialog->setUploadFile(QUrl::fromLocalFile(zipFileName));
......
......@@ -9,7 +9,8 @@
#include <QWidget>
namespace GrantleeThemeEditor {
namespace GrantleeThemeEditor
{
class ThemeEditorTabWidget;
class ThemeSession;
class DesktopFilePage;
......
......@@ -9,8 +9,8 @@
#include <KLocalizedString>
#include <QVBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
ThemeTemplateListWidget::ThemeTemplateListWidget(const QString &configName, QWidget *parent)
: PimCommon::TemplateListWidget(configName, parent)
......
......@@ -7,8 +7,8 @@
#ifndef THEMETEMPLATEWIDGET_H
#define THEMETEMPLATEWIDGET_H
#include <QWidget>
#include <PimCommon/TemplateListWidget>
#include <QWidget>
class ThemeTemplateListWidget : public PimCommon::TemplateListWidget
{
......
......@@ -13,17 +13,17 @@
#include <KContacts/VCardConverter>
#include <KLocalizedString>
#include <KConfig>
#include <KLocalizedString>
#include <KConfigGroup>
#include <QVBoxLayout>
#include <QLabel>
#include <QTabWidget>
#include <KSharedConfig>
#include <QDialogButtonBox>
#include <QLabel>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
ContactConfigureDialog::ContactConfigureDialog(QWidget *parent)
: QDialog(parent)
......
......@@ -8,15 +8,18 @@
#include <QDialog>
namespace GrantleeThemeEditor {
namespace GrantleeThemeEditor
{
class ConfigureWidget;
}
namespace Akonadi {
namespace Akonadi
{
class AkonadiContactEditor;
}
namespace KPIMTextEdit {
namespace KPIMTextEdit
{
class PlainTextEditorWidget;
}
class ContactConfigureDialog : public QDialog
......
......@@ -8,7 +8,8 @@
#include <PimCommon/TemplateListWidget>
namespace ContactDefaultTemplate {
namespace ContactDefaultTemplate
{
Q_REQUIRED_RESULT QVector<PimCommon::defaultTemplate> contactTemplates();
}
......
......@@ -4,25 +4,25 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "contacteditormainwindow.h"
#include "contactconfigurationdialog.h"
#include "contacteditorpage.h"
#include "newthemedialog.h"
#include "managethemes.h"
#include "contactconfigurationdialog.h"
#include "newthemedialog.h"
#include <KStandardAction>
#include <QApplication>
#include <QAction>
#include <KActionCollection>
#include <KAuthorized>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <QFileDialog>
#include <KRecentFilesAction>
#include <KConfigGroup>
#include <KAuthorized>