Commit 2e1b717c authored by Allen Winter's avatar Allen Winter

various - add include guards, remove dupe includes, misc header clean

and some minor coding style
parent a3376332
......@@ -19,11 +19,13 @@
02110-1301, USA.
*/
#ifndef KJOTS_LOCK_ATTRIBUTE_H
#define KJOTS_LOCK_ATTRIBUTE_H
#ifndef NOTELOCKATTRIBUTE_H
#define NOTELOCKATTRIBUTE_H
#include "noteshared_export.h"
#include <AkonadiCore/Attribute>
namespace NoteShared {
class NOTESHARED_EXPORT NoteLockAttribute : public Akonadi::Attribute
{
......
......@@ -31,10 +31,11 @@
your version.
*******************************************************************/
#ifndef NOTENETWORKSENDER_H
#define NOTENETWORKSENDER_H
#ifndef NOTESNETWORKSENDER_H
#define NOTESNETWORKSENDER_H
#include <QTcpSocket>
namespace NoteShared {
class NotesNetworkSender : public QObject
{
......
......@@ -18,7 +18,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*******************************************************************/
#include "config-knotes.h"
#include <config-knotes.h>
#include "knotesapp.h"
#include "configdialog/knoteconfigdialog.h"
#include "dialog/knoteselectednotesdialog.h"
......@@ -26,7 +27,6 @@
#include "akonadi/notesakonaditreemodel.h"
#include "akonadi/noteschangerecorder.h"
#include "attributes/notelockattribute.h"
#include "attributes/notelockattribute.h"
#include "attributes/notealarmattribute.h"
#include "attributes/showfoldernotesattribute.h"
......@@ -37,7 +37,6 @@
#include "notesharedglobalconfig.h"
#include "notes/knote.h"
#include "knotesadaptor.h"
#include "knotesapp.h"
#include "print/knoteprinter.h"
#include "print/knoteprintobject.h"
#include "knotesglobalconfig.h"
......@@ -197,8 +196,12 @@ KNotesApp::KNotesApp()
mNoteRecorder = new NoteShared::NotesChangeRecorder(this);
mNoteRecorder->changeRecorder()->setSession(session);
mTray = new KNotesAkonadiTray(nullptr);
connect(mTray, &KStatusNotifierItem::activateRequested, this, &KNotesApp::slotActivateRequested);
connect(mTray, &KStatusNotifierItem::secondaryActivateRequested, this, &KNotesApp::slotSecondaryActivateRequested);
connect(mTray, &KStatusNotifierItem::activateRequested,
this, &KNotesApp::slotActivateRequested);
connect(mTray, &KStatusNotifierItem::secondaryActivateRequested,
this, &KNotesApp::slotSecondaryActivateRequested);
mTray->setContextMenu(contextMenu);
mNoteTreeModel = new NoteShared::NotesAkonadiTreeModel(mNoteRecorder->changeRecorder(), this);
......@@ -206,10 +209,18 @@ KNotesApp::KNotesApp()
connect(mNoteTreeModel, &QAbstractItemModel::rowsInserted,
this, &KNotesApp::slotRowInserted);
connect(mNoteRecorder->changeRecorder(), &Akonadi::Monitor::itemChanged, this, &KNotesApp::slotItemChanged);
connect(mNoteRecorder->changeRecorder(), &Akonadi::Monitor::itemRemoved, this, &KNotesApp::slotItemRemoved);
connect(mNoteRecorder->changeRecorder(), SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)), SLOT(slotCollectionChanged(Akonadi::Collection,QSet<QByteArray>)));
connect(qApp, &QGuiApplication::commitDataRequest, this, &KNotesApp::slotCommitData, Qt::DirectConnection);
connect(mNoteRecorder->changeRecorder(), &Akonadi::Monitor::itemChanged,
this, &KNotesApp::slotItemChanged);
connect(mNoteRecorder->changeRecorder(), &Akonadi::Monitor::itemRemoved,
this, &KNotesApp::slotItemRemoved);
connect(mNoteRecorder->changeRecorder(), SIGNAL(collectionChanged(Akonadi::Collection,QSet<QByteArray>)),
SLOT(slotCollectionChanged(Akonadi::Collection,QSet<QByteArray>)));
connect(qApp, &QGuiApplication::commitDataRequest,
this, &KNotesApp::slotCommitData, Qt::DirectConnection);
QGuiApplication::setFallbackSessionManagementEnabled(false);
updateNoteActions();
}
......@@ -278,7 +289,8 @@ void KNotesApp::slotRowInserted(const QModelIndex &parent, int start, int end)
const QModelIndex child = mNoteTreeModel->index(i, 0, parent);
Akonadi::Item item
= mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
Akonadi::Collection parentCollection = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
Akonadi::Collection parentCollection =
mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
if (parentCollection.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
createNote(item);
needUpdate = true;
......@@ -397,7 +409,8 @@ void KNotesApp::newNoteFromTextFile()
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
text = QString::fromUtf8(f.readAll());
} else {
KMessageBox::error(this, i18n("Error during open text file: %1", f.errorString()), i18n("Open Text File"));
KMessageBox::error(this, i18n("Error during open text file: %1", f.errorString()),
i18n("Open Text File"));
return;
}
newNote(i18n("Note from file '%1'", filename), text);
......@@ -411,7 +424,9 @@ void KNotesApp::updateNetworkListener()
if (NoteShared::NoteSharedGlobalConfig::receiveNotes()) {
// create the socket and start listening for connections
m_publisher = new KDNSSD::PublicService(NoteShared::NoteSharedGlobalConfig::senderID(), QStringLiteral("_knotes._tcp"), NoteShared::NoteSharedGlobalConfig::port());
m_publisher = new KDNSSD::PublicService(NoteShared::NoteSharedGlobalConfig::senderID(),
QStringLiteral("_knotes._tcp"),
NoteShared::NoteSharedGlobalConfig::port());
m_publisher->publishAsync();
}
}
......
......@@ -18,7 +18,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*******************************************************************/
#include "config-knotes.h"
#include <config-knotes.h>
#include "knotes_debug.h"
#include "knotes-version.h"
......
......@@ -18,40 +18,40 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*******************************************************************/
#include "config-knotes.h"
#include <config-knotes.h>
#include "knoteconfigdialog.h"
#include "notes/knote.h"
#include "print/knoteprintselectthemecombobox.h"
#include "knotecollectionconfigwidget.h"
#include "knotedisplayconfigwidget.h"
#include "knoteeditorconfigwidget.h"
#include "knotecollectionconfigwidget.h"
#include "knotesglobalconfig.h"
#include "knotes-version.h"
#include "notesharedglobalconfig.h"
#include "config/noteactionconfig.h"
#include "config/notenetworkconfig.h"
#include "notes/knote.h"
#include "print/knoteprintselectthemecombobox.h"
#include "knotes-version.h"
#include <QLineEdit>
#include <qapplication.h>
#include <kcolorbutton.h>
#include <kconfig.h>
#include <kfontrequester.h>
#include <kiconloader.h>
#include <KLocalizedString>
#include <kwindowsystem.h>
#include <QIcon>
#include <KNS3/DownloadDialog>
#include <KAuthorized>
#include <QDialog>
#include <QApplication>
#include <QCheckBox>
#include <QDialog>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QIcon>
#include <QLabel>
#include <QLineEdit>
#include <QToolButton>
#include <QVBoxLayout>
#include <QWhatsThis>
#include <QToolButton>
#include <config/notenetworkconfig.h>
KNoteConfigDialog::KNoteConfigDialog(const QString &title, QWidget *parent)
: KCMultiDialog(parent)
......@@ -75,8 +75,12 @@ KNoteConfigDialog::KNoteConfigDialog(const QString &title, QWidget *parent)
addModule(QStringLiteral("knote_config_print"));
addModule(QStringLiteral("knote_config_collection"));
addModule(QStringLiteral("knote_config_misc"));
connect(button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &KNoteConfigDialog::slotOk);
connect(button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &KNoteConfigDialog::slotDefaultClicked);
connect(button(QDialogButtonBox::Ok), &QPushButton::clicked,
this, &KNoteConfigDialog::slotOk);
connect(button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked,
this, &KNoteConfigDialog::slotDefaultClicked);
}
KNoteConfigDialog::~KNoteConfigDialog()
......@@ -283,7 +287,9 @@ KNotePrintConfig::KNotePrintConfig(QWidget *parent)
void KNotePrintConfig::slotDownloadNewThemes()
{
QPointer<KNS3::DownloadDialog> downloadThemesDialog = new KNS3::DownloadDialog(QStringLiteral("knotes_printing_theme.knsrc"));
QPointer<KNS3::DownloadDialog> downloadThemesDialog =
new KNS3::DownloadDialog(QStringLiteral("knotes_printing_theme.knsrc"));
if (downloadThemesDialog->exec()) {
if (!downloadThemesDialog->changedEntries().isEmpty()) {
mSelectTheme->loadThemes();
......
......@@ -18,13 +18,14 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*******************************************************************/
#ifndef KNOTECONFIGDLG_H
#define KNOTECONFIGDLG_H
#ifndef KNOTECONFIGDIALOG_H
#define KNOTECONFIGDIALOG_H
#include "knotes_export.h"
#include <kconfigdialog.h>
#include <kcmodule.h>
#include <kcmultidialog.h>
#include "knotes_export.h"
class KNotePrintSelectThemeComboBox;
class KNoteCollectionConfigWidget;
......
......@@ -16,21 +16,21 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <config-knotes.h>
#include "knotedisplayconfigwidget.h"
#include "config-knotes.h"
#include "attributes/notedisplayattribute.h"
#include "attributes/notelockattribute.h"
#include <KLocalizedString>
#include <KColorButton>
#include <QSpinBox>
#include <KLocalizedString>
#include <QGridLayout>
#include <QLabel>
#include <QCheckBox>
#include <QDebug>
#include <attributes/notedisplayattribute.h>
#include <QGridLayout>
#include <QLabel>
#include <QSpinBox>
KNoteDisplayConfigWidget::KNoteDisplayConfigWidget(bool defaults, QWidget *parent)
: QWidget(parent)
......
......@@ -16,28 +16,28 @@
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config-knotes.h"
#include <config-knotes.h>
#include "knotesimpleconfigdialog.h"
#include "knoteconfigdialog.h"
#include "knotedisplayconfigwidget.h"
#include "knoteeditorconfigwidget.h"
#include "attributes/notedisplayattribute.h"
#include "attributes/notelockattribute.h"
#include <KConfigGroup>
#include <KIconLoader>
#include <KLocalizedString>
#include <KSharedConfig>
#include <KWindowSystem>
#include <KIconLoader>
#include <QTabWidget>
#include <QApplication>
#include <KSharedConfig>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QTabWidget>
#include <QVBoxLayout>
#include <attributes/notedisplayattribute.h>
KNoteSimpleConfigDialog::KNoteSimpleConfigDialog(const QString &title, QWidget *parent)
: QDialog(parent)
{
......@@ -91,7 +91,8 @@ void KNoteSimpleConfigDialog::slotUpdateCaption(const QString &name)
void KNoteSimpleConfigDialog::save(Akonadi::Item &item, bool &isRichText)
{
NoteShared::NoteDisplayAttribute *attr = item.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteDisplayAttribute *attr =
item.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
mEditorConfigWidget->save(attr, isRichText);
mDisplayConfigWidget->save(attr);
}
......
......@@ -22,72 +22,68 @@
*/
#include "knotes_part.h"
#include "knoteedit.h"
#include "knotes_kontact_plugin_debug.h"
#include "notesharedglobalconfig.h"
#include "noteutils.h"
#include "knoteseditdialog.h"
#include "knotesadaptor.h"
#include "knoteseditdialog.h"
#include "knotesglobalconfig.h"
#include "knotesiconview.h"
#include "knoteswidget.h"
#include "knotesselectdeletenotesdialog.h"
#include "knoteswidget.h"
#include "notesharedglobalconfig.h"
#include "noteutils.h"
#include "alarms/notealarmdialog.h"
#include "akonadi/notesakonaditreemodel.h"
#include "akonadi/noteschangerecorder.h"
#include "attributes/notealarmattribute.h"
#include "attributes/notedisplayattribute.h"
#include "attributes/notelockattribute.h"
#include "attributes/showfoldernotesattribute.h"
#include "configdialog/knoteconfigdialog.h"
#include "configdialog/knotesimpleconfigdialog.h"
#include "finddialog/knotefinddialog.h"
#include "job/createnewnotejob.h"
#include "print/knoteprinter.h"
#include "print/knoteprintobject.h"
#include "print/knoteprintselectthemedialog.h"
#include "knoteedit.h"
#include "knotesglobalconfig.h"
#include "configdialog/knotesimpleconfigdialog.h"
#include "finddialog/knotefinddialog.h"
#include "resources/localresourcecreator.h"
#include "utils/knoteutils.h"
#include "alarms/notealarmdialog.h"
#include "job/createnewnotejob.h"
#include "akonadi/notesakonaditreemodel.h"
#include "job/createnewnotejob.h"
#include "attributes/notealarmattribute.h"
#include "attributes/showfoldernotesattribute.h"
#include "attributes/notealarmattribute.h"
#include "attributes/notelockattribute.h"
#include "attributes/notelockattribute.h"
#include <Akonadi/Notes/NoteUtils>
#include <KDateTime>
#include <AkonadiCore/Session>
#include <AkonadiCore/ChangeRecorder>
#include <AkonadiWidgets/ETMViewStateSaver>
#include <AkonadiCore/EntityDisplayAttribute>
#include <AkonadiCore/ItemCreateJob>
#include <AkonadiCore/ItemFetchJob>
#include <KCheckableProxyModel>
#include <AkonadiCore/itemdeletejob.h>
#include <AkonadiCore/ItemFetchScope>
#include <QUrl>
#include <QFileDialog>
#include <KMime/KMimeMessage>
#include <AkonadiCore/ItemModifyJob>
#include <AkonadiCore/Session>
#include <AkonadiCore/itemdeletejob.h>
#include <AkonadiWidgets/ControlGui>
#include <akonadi/noteschangerecorder.h>
#include <attributes/notedisplayattribute.h>
#include <resources/localresourcecreator.h>
#include <AkonadiWidgets/ETMViewStateSaver>
#include <KMime/KMimeMessage>
#include <KActionCollection>
#include <QAction>
#include <QInputDialog>
#include <KMessageBox>
#include <KXMLGUIFactory>
#include <KCheckableProxyModel>
#include <KDateTime>
#include <KFileDialog>
#include <KToggleAction>
#include <KLocalizedString>
#include <QIcon>
#include <KToggleAction>
#include <KXMLGUIFactory>
#include <KMessageBox>
#include <QAction>
#include <QApplication>
#include <QCheckBox>
#include <QClipboard>
#include <QFileDialog>
#include <QIcon>
#include <QInputDialog>
#include <QMenu>
#include <QPointer>
#include <QCheckBox>
#include <QUrl>
#include <dnssd/publicservice.h>
......@@ -289,7 +285,8 @@ void KNotesPart::slotRowInserted(const QModelIndex &parent, int start, int end)
for (int i = start; i <= end; ++i) {
if (mNoteTreeModel->hasIndex(i, 0, parent)) {
const QModelIndex child = mNoteTreeModel->index(i, 0, parent);
Akonadi::Collection parentCollection = mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
Akonadi::Collection parentCollection =
mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ParentCollectionRole).value<Akonadi::Collection>();
if (parentCollection.hasAttribute<NoteShared::ShowFolderNotesAttribute>()) {
Akonadi::Item item
= mNoteTreeModel->data(child, Akonadi::EntityTreeModel::ItemRole).value<Akonadi::Item>();
......@@ -505,7 +502,10 @@ void KNotesPart::popupRMB(QListWidgetItem *item, const QPoint &pos, const QPoint
if (mNotesWidget->notesView()->itemAt(pos)) {
contextMenu->addAction(mNewNote);
const bool uniqueNoteSelected = (mNotesWidget->notesView()->selectedItems().count() == 1);
const bool readOnly = uniqueNoteSelected ? static_cast<KNotesIconViewItem *>(mNotesWidget->notesView()->selectedItems().at(0))->readOnly() : false;
const bool readOnly = uniqueNoteSelected ?
static_cast<KNotesIconViewItem *>(mNotesWidget->notesView()->selectedItems().at(0))->readOnly() :
false;
if (uniqueNoteSelected) {
if (!readOnly) {
contextMenu->addSeparator();
......@@ -609,7 +609,8 @@ void KNotesPart::slotOnCurrentChanged()
mSaveAs->setEnabled(uniqueNoteSelected);
mReadOnly->setEnabled(uniqueNoteSelected);
if (uniqueNoteSelected) {
const bool readOnly = static_cast<KNotesIconViewItem *>(mNotesWidget->notesView()->selectedItems().at(0))->readOnly();
const bool readOnly =
static_cast<KNotesIconViewItem *>(mNotesWidget->notesView()->selectedItems().at(0))->readOnly();
mReadOnly->setChecked(readOnly);
mNoteEdit->setText(readOnly ? i18n("Show Note...") : i18nc("@action:inmenu", "Edit..."));
} else {
......@@ -684,7 +685,9 @@ void KNotesPart::updateNetworkListener()
if (NoteShared::NoteSharedGlobalConfig::receiveNotes()) {
// create the socket and start listening for connections
mPublisher = new KDNSSD::PublicService(NoteShared::NoteSharedGlobalConfig::senderID(), QStringLiteral("_knotes._tcp"), NoteShared::NoteSharedGlobalConfig::port());
mPublisher = new KDNSSD::PublicService(NoteShared::NoteSharedGlobalConfig::senderID(),
QStringLiteral("_knotes._tcp"),
NoteShared::NoteSharedGlobalConfig::port());
mPublisher->publishAsync();
}
}
......@@ -704,7 +707,8 @@ void KNotesPart::slotSetAlarm()
bool needToModify = true;
QDateTime dateTime = dlg->alarm();
if (dateTime.isValid()) {
NoteShared::NoteAlarmAttribute *attribute = item.attribute<NoteShared::NoteAlarmAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteAlarmAttribute *attribute =
item.attribute<NoteShared::NoteAlarmAttribute>(Akonadi::Item::AddIfMissing);
attribute->setDateTime(dateTime);
} else {
if (item.hasAttribute<NoteShared::NoteAlarmAttribute>()) {
......@@ -780,7 +784,8 @@ void KNotesPart::slotSaveAs()
doc.setHtml(knoteItem->description());
if (htmlFormatAndSaveAsHtml) {
QString htmlStr = doc.toHtml();
htmlStr.replace(QStringLiteral("meta name=\"qrichtext\" content=\"1\""), QStringLiteral("meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\""));
htmlStr.replace(QStringLiteral("meta name=\"qrichtext\" content=\"1\""),
QStringLiteral("meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\""));
stream << htmlStr;
} else {
stream << knoteItem->realName() + QLatin1Char('\n');
......@@ -890,7 +895,9 @@ void KNotesPart::slotNewNoteFromTextFile()
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
text = QString::fromUtf8(f.readAll());
} else {
KMessageBox::error(widget(), i18n("Error during open text file: %1", f.errorString()), i18n("Open Text File"));
KMessageBox::error(widget(),
i18n("Error during open text file: %1", f.errorString()),
i18n("Open Text File"));
return;
}
newNote(i18n("Note from file '%1'", filename), text);
......
......@@ -17,42 +17,41 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*******************************************************************/
#include "config-knotes.h"
#include "knotes_debug.h"
#include <config-knotes.h>
#include "knote.h"
#include "knotes_debug.h"
#include "noteutils.h"
#include "alarms/notealarmdialog.h"
#include "configdialog/knotesimpleconfigdialog.h"
#include "print/knoteprintselectthemedialog.h"
#include "notes/knotebutton.h"
#include "utils/knoteutils.h"
#include "attributes/notealarmattribute.h"
#include "attributes/notelockattribute.h"
#include "configdialog/knoteconfigdialog.h"
#include "configdialog/knotesimpleconfigdialog.h"
#include "knotedisplaysettings.h"
#include "knoteedit.h"
#include "knotesglobalconfig.h"
#include "notes/knotebutton.h"
#include "print/knoteprinter.h"
#include "print/knoteprintobject.h"
#include "knotesglobalconfig.h"
#include "knotedisplaysettings.h"
#include "attributes/notelockattribute.h"
#include "attributes/notealarmattribute.h"
#include "print/knoteprintselectthemedialog.h"
#include "utils/knoteutils.h"
#include <AkonadiCore/ItemModifyJob>
#include <AkonadiSearch/Debug/akonadisearchdebugdialog.h>
#include <KMime/KMimeMessage>
#include <KLocalizedString>
#include <kactioncollection.h>
#include <kcombobox.h>
#include <kfiledialog.h>
#include <kiconeffect.h>
#include <kiconloader.h>
#include <qinputdialog.h>
#include <KLocalizedString>
#include <QMenu>
#include <kmessagebox.h>
#include <kselectaction.h>
#include <kstandardaction.h>
#include <ktoggleaction.h>
#include <ktoolbar.h>
#include <kwindowsystem.h>
......@@ -60,23 +59,23 @@
#include <kxmlguifactory.h>
#include <netwm.h>
#include <AkonadiCore/ItemModifyJob>
#include <QApplication>
#include <QBoxLayout>
#include <QCheckBox>
#include <QDesktopWidget>
#include <QFile>
#include <QFocusEvent>
#include <QHBoxLayout>
#include <QInputDialog>
#include <QLabel>
#include <QMenu>
#include <QMimeData>
#include <QPixmap>
#include <QPointer>
#include <QSize>
#include <QSizeGrip>
#include <QTextStream>
#include <QVBoxLayout>
#include <QPointer>
#include <QFocusEvent>
#include <QMimeData>
#include <QDesktopWidget>
#include <QApplication>
#if KDEPIM_HAVE_X11
#include <fixx11h.h>
......@@ -156,14 +155,14 @@ void KNote::setChangeItem(const Akonadi::Item &item, const QSet<QByteArray> &set
void KNote::slotKill(bool force)
{
if (!force
&& (KMessageBox::warningContinueCancel(this,
i18n("<qt>Do you really want to delete note <b>%1</b>?</qt>",
m_label->text()),
i18n("Confirm Delete"),
KGuiItem(i18n("&Delete"), QStringLiteral("edit-delete")),
KStandardGuiItem::cancel(),
QStringLiteral("ConfirmDeleteNote")) != KMessageBox::Continue)) {
if (!force &&
KMessageBox::warningContinueCancel(this,
i18n("<qt>Do you really want to delete note <b>%1</b>?</qt>", m_label->text()),
i18n("Confirm Delete"),
KGuiItem(i18n("&Delete"),
QStringLiteral("edit-delete")),
KStandardGuiItem::cancel(),
QStringLiteral("ConfirmDeleteNote")) != KMessageBox::Continue) {
return;
}
......@@ -178,7 +177,8 @@ void KNote::saveNote(bool force, bool sync)
return;
}
bool needToSave = false;
NoteShared::NoteDisplayAttribute *attribute = mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteDisplayAttribute *attribute =
mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
const QPoint notePosition = pos();
if (attribute->position() != notePosition) {
needToSave = true;
......@@ -285,7 +285,8 @@ void KNote::slotRename()
bool ok;
const QString oldName = m_label->text();
const QString newName = QInputDialog::getText(this, QString(),
i18n("Please enter the new name:"), QLineEdit::Normal, m_label->text(), &ok);
i18n("Please enter the new name:"),
QLineEdit::Normal, m_label->text(), &ok);
if (!ok || (oldName == newName)) { // handle cancel
return;
}
......@@ -351,7 +352,8 @@ void KNote::slotUpdateReadOnly()
void KNote::updateAllAttributes()
{
#if KDEPIM_HAVE_X11
NoteShared::NoteDisplayAttribute *attribute = mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteDisplayAttribute *attribute =
mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
KWindowInfo info(winId(), NET::WMDesktop);
const int count = KWindowSystem::numberOfDesktops();
for (int n = 1; n <= count; ++n) {
......@@ -391,7 +393,8 @@ void KNote::slotSetAlarm()
bool needToModify = true;
QDateTime dateTime = dlg->alarm();
if (dateTime.isValid()) {
NoteShared::NoteAlarmAttribute *attribute = mItem.attribute<NoteShared::NoteAlarmAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteAlarmAttribute *attribute =
mItem.attribute<NoteShared::NoteAlarmAttribute>(Akonadi::Item::AddIfMissing);
attribute->setDateTime(dateTime);
} else {
if (mItem.hasAttribute<NoteShared::NoteAlarmAttribute>()) {
......@@ -437,7 +440,8 @@ void KNote::slotPreferences()
{
// create a new preferences dialog...
QPointer<KNoteSimpleConfigDialog> dialog = new KNoteSimpleConfigDialog(name(), this);
NoteShared::NoteDisplayAttribute *attribute = mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
NoteShared::NoteDisplayAttribute *attribute =
mItem.attribute<NoteShared::NoteDisplayAttribute>(Akonadi::Item::AddIfMissing);
attribute->setSize(QSize(width(), height()));
dialog->load(mItem, m_editor->acceptRichText());
......@@ -535,11 +539,11 @@ void KNote::slotSaveAs()
QFile file(fileName);
if (file.exists()
&&