Commit a7dd0710 authored by David Faure's avatar David Faure

Fix constness of Attributes, in preparation for changes in akonadi

parent 492b9bf9
......@@ -97,7 +97,7 @@ void NotesAgentNoteDialog::slotFetchItem(KJob *job)
}
}
if (item.hasAttribute<NoteShared::NoteDisplayAttribute>()) {
NoteShared::NoteDisplayAttribute *attr = item.attribute<NoteShared::NoteDisplayAttribute>();
const NoteShared::NoteDisplayAttribute *attr = item.attribute<NoteShared::NoteDisplayAttribute>();
if (attr) {
mNote->editor()->setTextColor(attr->backgroundColor());
//TODO add background color.
......
......@@ -145,7 +145,7 @@ void NotesManager::slotCheckAlarm()
Akonadi::Item::List lst;
Q_FOREACH (const Akonadi::Item &item, mListItem) {
NoteShared::NoteAlarmAttribute *attrAlarm = item.attribute<NoteShared::NoteAlarmAttribute>();
const NoteShared::NoteAlarmAttribute *attrAlarm = item.attribute<NoteShared::NoteAlarmAttribute>();
if (attrAlarm) {
if (attrAlarm->dateTime() < QDateTime::currentDateTime()) {
lst.append(item);
......
......@@ -104,7 +104,7 @@ QString NoteUtils::createToolTip(const Akonadi::Item &item)
QString tip;
if (item.hasAttribute<NoteDisplayAttribute>()) {
NoteDisplayAttribute *attr = item.attribute<NoteDisplayAttribute>();
const NoteDisplayAttribute *attr = item.attribute<NoteDisplayAttribute>();
if (attr) {
const QString bckColorName = attr->backgroundColor().name();
const QString txtColorName = attr->foregroundColor().name();
......
......@@ -62,7 +62,7 @@ QVariant KNoteCollectionDisplayProxyModel::data(const QModelIndex &index, int ro
if (mDisplayCollection.contains(collection)) {
return mDisplayCollection.value(collection) ? Qt::Checked : Qt::Unchecked;
} else {
NoteShared::ShowFolderNotesAttribute *attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
const NoteShared::ShowFolderNotesAttribute *attr = collection.attribute<NoteShared::ShowFolderNotesAttribute>();
if (attr) {
return Qt::Checked;
}
......
......@@ -29,12 +29,12 @@ KNoteDisplaySettings::~KNoteDisplaySettings()
{
}
void KNoteDisplaySettings::setDisplayAttribute(NoteShared::NoteDisplayAttribute *attr)
void KNoteDisplaySettings::setDisplayAttribute(const NoteShared::NoteDisplayAttribute *attr)
{
mDisplayAttribute = attr;
}
NoteShared::NoteDisplayAttribute *KNoteDisplaySettings::displayAttribute() const
const NoteShared::NoteDisplayAttribute *KNoteDisplaySettings::displayAttribute() const
{
return mDisplayAttribute;
}
......
......@@ -34,8 +34,8 @@ public:
explicit KNoteDisplaySettings(NoteShared::NoteDisplayAttribute *attr = nullptr);
~KNoteDisplaySettings();
void setDisplayAttribute(NoteShared::NoteDisplayAttribute *attr);
NoteShared::NoteDisplayAttribute *displayAttribute() const;
void setDisplayAttribute(const NoteShared::NoteDisplayAttribute *attr);
const NoteShared::NoteDisplayAttribute *displayAttribute() const;
QColor backgroundColor() const;
QColor foregroundColor() const;
......@@ -53,7 +53,7 @@ public:
bool autoIndent() const;
private:
NoteShared::NoteDisplayAttribute *mDisplayAttribute = nullptr;
const NoteShared::NoteDisplayAttribute *mDisplayAttribute = nullptr;
};
#endif // KNOTEDISPLAYSETTINGS_H
......@@ -66,7 +66,7 @@ bool KNotePrintObject::hasAlarm() const
QString KNotePrintObject::alarm() const
{
NoteShared::NoteAlarmAttribute *attr = mItem.attribute<NoteShared::NoteAlarmAttribute>();
const NoteShared::NoteAlarmAttribute *attr = mItem.attribute<NoteShared::NoteAlarmAttribute>();
if (attr) {
return QLocale().toString(attr->dateTime(), QLocale::LongFormat);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment