Changeset View
Changeset View
Standalone View
Standalone View
src/messagewin.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | |||||
43 | #include <KPIMTextEdit/TextToSpeech> | 43 | #include <KPIMTextEdit/TextToSpeech> | ||
44 | #include <AkonadiCore/ItemFetchJob> | 44 | #include <AkonadiCore/ItemFetchJob> | ||
45 | #include <AkonadiCore/ItemFetchScope> | 45 | #include <AkonadiCore/ItemFetchScope> | ||
46 | 46 | | |||
47 | #include <KAboutData> | 47 | #include <KAboutData> | ||
48 | #include <KStandardGuiItem> | 48 | #include <KStandardGuiItem> | ||
49 | #include <KLocalizedString> | 49 | #include <KLocalizedString> | ||
50 | #include <KConfig> | 50 | #include <KConfig> | ||
51 | #include <KIconLoader> | | |||
52 | #include <KTextEdit> | 51 | #include <KTextEdit> | ||
53 | #include <KWindowSystem> | 52 | #include <KWindowSystem> | ||
54 | #include <KIO/StatJob> | 53 | #include <KIO/StatJob> | ||
55 | #include <KIO/StoredTransferJob> | 54 | #include <KIO/StoredTransferJob> | ||
56 | #include <KJobWidgets> | 55 | #include <KJobWidgets> | ||
57 | #include <KNotification> | 56 | #include <KNotification> | ||
58 | #include <KSqueezedTextLabel> | 57 | #include <KSqueezedTextLabel> | ||
59 | #include <phonon/mediaobject.h> | 58 | #include <phonon/mediaobject.h> | ||
▲ Show 20 Lines • Show All 538 Lines • ▼ Show 20 Line(s) | 337 | { | |||
598 | { | 597 | { | ||
599 | setCaption(i18nc("@title:window", "Error")); | 598 | setCaption(i18nc("@title:window", "Error")); | ||
600 | QHBoxLayout* layout = new QHBoxLayout(); | 599 | QHBoxLayout* layout = new QHBoxLayout(); | ||
601 | int m = 2 * dcm; | 600 | int m = 2 * dcm; | ||
602 | layout->setContentsMargins(m, m, m, m); | 601 | layout->setContentsMargins(m, m, m, m); | ||
603 | layout->addStretch(); | 602 | layout->addStretch(); | ||
604 | topLayout->addLayout(layout); | 603 | topLayout->addLayout(layout); | ||
605 | QLabel* label = new QLabel(topWidget); | 604 | QLabel* label = new QLabel(topWidget); | ||
606 | label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-error")).pixmap(IconSize(KIconLoader::Desktop), IconSize(KIconLoader::Desktop))); | 605 | label->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-error")).pixmap(style()->pixelMetric(QStyle::PM_MessageBoxIconSize))); | ||
607 | label->setFixedSize(label->sizeHint()); | 606 | label->setFixedSize(label->sizeHint()); | ||
608 | layout->addWidget(label, 0, Qt::AlignRight); | 607 | layout->addWidget(label, 0, Qt::AlignRight); | ||
609 | QVBoxLayout* vlayout = new QVBoxLayout(); | 608 | QVBoxLayout* vlayout = new QVBoxLayout(); | ||
610 | layout->addLayout(vlayout); | 609 | layout->addLayout(vlayout); | ||
611 | for (QStringList::ConstIterator it = mErrorMsgs.constBegin(); it != mErrorMsgs.constEnd(); ++it) | 610 | for (QStringList::ConstIterator it = mErrorMsgs.constBegin(); it != mErrorMsgs.constEnd(); ++it) | ||
612 | { | 611 | { | ||
613 | label = new QLabel(*it, topWidget); | 612 | label = new QLabel(*it, topWidget); | ||
614 | label->setFixedSize(label->sizeHint()); | 613 | label->setFixedSize(label->sizeHint()); | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
658 | mDeferButton->setWhatsThis(xi18nc("@info:whatsthis", "<para>Defer the alarm until later.</para>" | 657 | mDeferButton->setWhatsThis(xi18nc("@info:whatsthis", "<para>Defer the alarm until later.</para>" | ||
659 | "<para>You will be prompted to specify when the alarm should be redisplayed.</para>")); | 658 | "<para>You will be prompted to specify when the alarm should be redisplayed.</para>")); | ||
660 | 659 | | |||
661 | if (mNoDefer) | 660 | if (mNoDefer) | ||
662 | mDeferButton->hide(); | 661 | mDeferButton->hide(); | ||
663 | else | 662 | else | ||
664 | setDeferralLimit(mEvent); // ensure that button is disabled when alarm can't be deferred any more | 663 | setDeferralLimit(mEvent); // ensure that button is disabled when alarm can't be deferred any more | ||
665 | 664 | | |||
666 | KIconLoader iconLoader; | | |||
667 | if (!mAudioFile.isEmpty() && (mVolume || mFadeVolume > 0)) | 665 | if (!mAudioFile.isEmpty() && (mVolume || mFadeVolume > 0)) | ||
668 | { | 666 | { | ||
669 | // Silence button to stop sound repetition | 667 | // Silence button to stop sound repetition | ||
670 | const QPixmap pixmap = iconLoader.loadIcon(QStringLiteral("media-playback-stop"), KIconLoader::MainToolbar); | | |||
671 | mSilenceButton = new PushButton(topWidget); | 668 | mSilenceButton = new PushButton(topWidget); | ||
672 | mSilenceButton->setIcon(pixmap); | 669 | mSilenceButton->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-stop"))); | ||
673 | grid->addWidget(mSilenceButton, 0, gridIndex++, Qt::AlignHCenter); | 670 | grid->addWidget(mSilenceButton, 0, gridIndex++, Qt::AlignHCenter); | ||
674 | mSilenceButton->setToolTip(i18nc("@info:tooltip", "Stop sound")); | 671 | mSilenceButton->setToolTip(i18nc("@info:tooltip", "Stop sound")); | ||
675 | mSilenceButton->setWhatsThis(i18nc("@info:whatsthis", "Stop playing the sound")); | 672 | mSilenceButton->setWhatsThis(i18nc("@info:whatsthis", "Stop playing the sound")); | ||
676 | // To avoid getting in a mess, disable the button until sound playing has been set up | 673 | // To avoid getting in a mess, disable the button until sound playing has been set up | ||
677 | mSilenceButton->setEnabled(false); | 674 | mSilenceButton->setEnabled(false); | ||
678 | } | 675 | } | ||
679 | 676 | | |||
680 | if (mAkonadiItemId >= 0) | 677 | if (mAkonadiItemId >= 0) | ||
681 | { | 678 | { | ||
682 | // KMail button | 679 | // KMail button | ||
683 | const QPixmap pixmap = iconLoader.loadIcon(QStringLiteral("internet-mail"), KIconLoader::MainToolbar); | | |||
684 | mKMailButton = new PushButton(topWidget); | 680 | mKMailButton = new PushButton(topWidget); | ||
685 | mKMailButton->setIcon(pixmap); | 681 | mKMailButton->setIcon(QIcon::fromTheme(QStringLiteral("internet-mail"))); | ||
686 | connect(mKMailButton, &QAbstractButton::clicked, this, &MessageWin::slotShowKMailMessage); | 682 | connect(mKMailButton, &QAbstractButton::clicked, this, &MessageWin::slotShowKMailMessage); | ||
687 | grid->addWidget(mKMailButton, 0, gridIndex++, Qt::AlignHCenter); | 683 | grid->addWidget(mKMailButton, 0, gridIndex++, Qt::AlignHCenter); | ||
688 | mKMailButton->setToolTip(xi18nc("@info:tooltip Locate this email in KMail", "Locate in <application>KMail</application>")); | 684 | mKMailButton->setToolTip(xi18nc("@info:tooltip Locate this email in KMail", "Locate in <application>KMail</application>")); | ||
689 | mKMailButton->setWhatsThis(xi18nc("@info:whatsthis", "Locate and highlight this email in <application>KMail</application>")); | 685 | mKMailButton->setWhatsThis(xi18nc("@info:whatsthis", "Locate and highlight this email in <application>KMail</application>")); | ||
690 | } | 686 | } | ||
691 | 687 | | |||
692 | // KAlarm button | 688 | // KAlarm button | ||
693 | const QPixmap pixmap = iconLoader.loadIcon(KAboutData::applicationData().componentName(), KIconLoader::MainToolbar); | | |||
694 | mKAlarmButton = new PushButton(topWidget); | 689 | mKAlarmButton = new PushButton(topWidget); | ||
695 | mKAlarmButton->setIcon(pixmap); | 690 | mKAlarmButton->setIcon(QIcon::fromTheme(KAboutData::applicationData().componentName())); | ||
696 | connect(mKAlarmButton, &QAbstractButton::clicked, this, &MessageWin::displayMainWindow); | 691 | connect(mKAlarmButton, &QAbstractButton::clicked, this, &MessageWin::displayMainWindow); | ||
697 | grid->addWidget(mKAlarmButton, 0, gridIndex++, Qt::AlignHCenter); | 692 | grid->addWidget(mKAlarmButton, 0, gridIndex++, Qt::AlignHCenter); | ||
698 | mKAlarmButton->setToolTip(xi18nc("@info:tooltip", "Activate <application>KAlarm</application>")); | 693 | mKAlarmButton->setToolTip(xi18nc("@info:tooltip", "Activate <application>KAlarm</application>")); | ||
699 | mKAlarmButton->setWhatsThis(xi18nc("@info:whatsthis", "Activate <application>KAlarm</application>")); | 694 | mKAlarmButton->setWhatsThis(xi18nc("@info:whatsthis", "Activate <application>KAlarm</application>")); | ||
700 | 695 | | |||
701 | int butsize = mKAlarmButton->sizeHint().height(); | 696 | int butsize = mKAlarmButton->sizeHint().height(); | ||
702 | if (mSilenceButton) | 697 | if (mSilenceButton) | ||
703 | butsize = qMax(butsize, mSilenceButton->sizeHint().height()); | 698 | butsize = qMax(butsize, mSilenceButton->sizeHint().height()); | ||
▲ Show 20 Lines • Show All 1715 Lines • Show Last 20 Lines |