Commit 46b96bc9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Clean up. Minor optimization

parent 2d2dcc91
......@@ -104,7 +104,6 @@ void ExportWebDialog::slotOk()
void ExportWebDialog::slotDefault()
{
if (KMessageBox::warningContinueCancel(
this,
i18n("You are about to set all preferences to default values. "
......
......@@ -309,13 +309,13 @@ void FilterEdit::updateSelectedName(const QString &newText)
bool FilterEdit::correctName(const QString &newText)
{
bool negative = false;
#ifndef QT_NO_STYLE_STYLESHEET
QString styleSheet;
if (mNegativeBackground.isEmpty()) {
KStatefulBrush bgBrush = KStatefulBrush(KColorScheme::View, KColorScheme::NegativeBackground);
mNegativeBackground = QStringLiteral("QLineEdit{ background-color:%1 }").arg(bgBrush.brush(mNameLineEdit).color().name());
}
bool negative = false;
if (!newText.isEmpty()) {
for (int i = 0; i < mRulesList->count(); ++i) {
QListWidgetItem *item = mRulesList->item(i);
......
......@@ -47,8 +47,8 @@ KOEventViewerDialog::KOEventViewerDialog(Akonadi::ETMCalendar *calendar, QWidget
: QDialog(parent)
{
setWindowTitle(i18n("Event Viewer"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this);
mUser1Button = new QPushButton(this);
buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
QPushButton *user2Button = new QPushButton(this);
......
......@@ -70,9 +70,8 @@ SearchDialog::SearchDialog(CalendarView *calendarview)
layout->addWidget(listView);
m_ui->listViewFrame->setLayout(layout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Help);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(mainWidget);
mUser1Button = new QPushButton;
buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole);
......@@ -236,7 +235,8 @@ void SearchDialog::search(const QRegExp &re)
}
}
if (m_ui->attendeeCheck->isChecked()) {
Q_FOREACH (const KCalCore::Attendee::Ptr &attendee, ev->attendees()) {
const KCalCore::Attendee::List lstAttendees = ev->attendees();
for (const KCalCore::Attendee::Ptr &attendee : lstAttendees) {
if (re.indexIn(attendee->fullName()) != -1) {
mMatchedEvents.append(item);
break;
......
......@@ -64,7 +64,8 @@ void SearchCollectionHelper::onSearchCollectionsFetched(KJob *job)
qCWarning(KORGANIZER_LOG) << "Search failed: " << job->errorString();
} else {
Akonadi::CollectionFetchJob *fetchJob = static_cast<Akonadi::CollectionFetchJob *>(job);
Q_FOREACH (const Akonadi::Collection &col, fetchJob->collections()) {
const Akonadi::Collection::List lstCols = fetchJob->collections();
for (const Akonadi::Collection &col : lstCols) {
if (col.name() == QLatin1String("OpenInvitations")) {
mOpenInvitationCollection = col;
} else if (col.name() == QLatin1String("DeclinedInvitations")) {
......@@ -81,7 +82,8 @@ void SearchCollectionHelper::updateSearchCollection(Akonadi::Collection col, KCa
// Update or create search collections
Akonadi::SearchQuery query(Akonadi::SearchTerm::RelOr);
foreach (const QString email, mIdentityManager->allEmails()) {
const QStringList lstEmails = mIdentityManager->allEmails();
for (const QString email : lstEmails) {
if (!email.isEmpty()) {
query.addTerm(Akonadi::IncidenceSearchTerm(Akonadi::IncidenceSearchTerm::PartStatus, QString(email + QString::number(status))));
}
......
......@@ -506,7 +506,7 @@ void HtmlExportJob::createTodoList(QTextStream *ts)
while (index < rawTodoList.count()) {
const KCalCore::Todo::Ptr todo = rawTodoList.value(index);
Q_ASSERT(todo);
const Akonadi::Item parentItem = d->mCalendar->item(todo->relatedTo());
//const Akonadi::Item parentItem = d->mCalendar->item(todo->relatedTo());
++index;
}
......
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