Commit dbdca98a authored by Laurent Montel's avatar Laurent Montel 😁

Add some QLatin1String

parent 6f66a7c2
......@@ -3,6 +3,10 @@ project(kalarm)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5950)
add_definitions(-DQT_STRICT_ITERATORS)
#add_definitions( -DQT_NO_CAST_FROM_ASCII )
#add_definitions( -DQT_NO_CAST_TO_ASCII )
option(KALARM_USE_AKONADI "Build to use Akonadi" ON)
# Kalarm from kdepim master needs kdepimlibs 4.7
......
......@@ -499,7 +499,7 @@ void AlarmCalendar::close()
if (!mLocalFile.isEmpty())
{
KIO::NetAccess::removeTempFile(mLocalFile); // removes it only if it IS a temporary file
mLocalFile = "";
mLocalFile = QLatin1String("");
}
}
// Flag as closed now to prevent removeKAEvents() doing silly things
......
......@@ -63,7 +63,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
: KDialog(parent),
mSpecialActionsButton(0)
{
setObjectName("BirthdayDlg"); // used by LikeBack
setObjectName(QLatin1String("BirthdayDlg")); // used by LikeBack
setCaption(i18nc("@title:window", "Import Birthdays From KAddressBook"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
......
......@@ -233,7 +233,7 @@ void EditAlarmDlg::init(const KAEvent* event, GetResourceType getResource)
void EditAlarmDlg::init(const KAEvent* event)
{
setObjectName(mTemplate ? "TemplEditDlg" : "EditDlg"); // used by LikeBack
setObjectName(mTemplate ? QLatin1String("TemplEditDlg") : QLatin1String("EditDlg")); // used by LikeBack
QString caption;
if (mReadOnly)
caption = mTemplate ? i18nc("@title:window", "Alarm Template [read-only]")
......@@ -1295,7 +1295,7 @@ void EditAlarmDlg::slotEditDeferral()
// deletion of EditAlarmDlg, and on return from this function).
AutoQPointer<DeferAlarmDlg> deferDlg = new DeferAlarmDlg((deferred ? mDeferDateTime : DateTime(now.addSecs(60).toTimeSpec(start.timeSpec()))),
start.isDateOnly(), deferred, this);
deferDlg->setObjectName("EditDeferDlg"); // used by LikeBack
deferDlg->setObjectName(QLatin1String("EditDeferDlg")); // used by LikeBack
if (limit)
{
// Don't allow deferral past the next recurrence
......
......@@ -206,7 +206,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// File browse button
mFileBrowseButton = new QPushButton(mFileBox);
mFileBrowseButton->setIcon(SmallIcon("document-open"));
mFileBrowseButton->setIcon(SmallIcon(QLatin1String("document-open")));
int size = mFileBrowseButton->sizeHint().height();
mFileBrowseButton->setFixedSize(size, size);
mFileBrowseButton->setToolTip(i18nc("@info:tooltip", "Choose a file"));
......@@ -798,7 +798,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
// Log file browse button.
// The file browser dialog is activated by the PickLogFileRadio class.
QPushButton* browseButton = new QPushButton(box);
browseButton->setIcon(SmallIcon("document-open"));
browseButton->setIcon(SmallIcon(QLatin1String("document-open")));
int size = browseButton->sizeHint().height();
browseButton->setFixedSize(size, size);
browseButton->setToolTip(i18nc("@info:tooltip", "Choose a file"));
......@@ -1101,7 +1101,7 @@ void EditEmailAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
grid->addWidget(mEmailToEdit, 1, 1);
mEmailAddressButton = new QPushButton(parent);
mEmailAddressButton->setIcon(SmallIcon("help-contents"));
mEmailAddressButton->setIcon(SmallIcon(QLatin1String("help-contents")));
int size = mEmailAddressButton->sizeHint().height();
mEmailAddressButton->setFixedSize(size, size);
connect(mEmailAddressButton, SIGNAL(clicked()), SLOT(openAddressBook()));
......@@ -1172,7 +1172,7 @@ void EditEmailAlarmDlg::type_initValues(const KAEvent* event)
{
// Set the values to those for the specified event
mEmailAttachList->addItems(event->emailAttachments());
mEmailToEdit->setText(event->emailAddresses(", "));
mEmailToEdit->setText(event->emailAddresses(QLatin1String(", ")));
mEmailSubjectEdit->setText(event->emailSubject());
mEmailBcc->setChecked(event->emailBcc());
if (mEmailFromList)
......@@ -1228,7 +1228,7 @@ void EditEmailAlarmDlg::setEmailFields(uint fromID, const QList<KCal::Person>& a
if (fromID)
mEmailFromList->setCurrentIdentity(fromID);
if (!addresses.isEmpty())
mEmailToEdit->setText(KAEvent::joinEmailAddresses(addresses, ", "));
mEmailToEdit->setText(KAEvent::joinEmailAddresses(addresses, QLatin1String(", ")));
if (!subject.isEmpty())
mEmailSubjectEdit->setText(subject);
if (!attachments.isEmpty())
......@@ -1392,14 +1392,14 @@ void EditEmailAlarmDlg::slotTrySuccess()
{
disconnect(theApp(), SIGNAL(execAlarmSuccess()), this, SLOT(slotTrySuccess()));
QString msg;
QString to = KAEvent::joinEmailAddresses(mEmailAddresses, "<nl/>");
to.replace('<', "&lt;");
to.replace('>', "&gt;");
QString to = KAEvent::joinEmailAddresses(mEmailAddresses, QLatin1String("<nl/>"));
to.replace(QLatin1Char('<'), QLatin1String("&lt;"));
to.replace(QLatin1Char('>'), QLatin1String("&gt;"));
if (mEmailBcc->isChecked())
msg = "<qt>" + i18nc("@info", "Email sent to:<nl/>%1<nl/>Bcc: <email>%2</email>",
to, Preferences::emailBccAddress()) + "</qt>";
msg = QLatin1String("<qt>") + i18nc("@info", "Email sent to:<nl/>%1<nl/>Bcc: <email>%2</email>",
to, Preferences::emailBccAddress()) + QLatin1String("</qt>");
else
msg = "<qt>" + i18nc("@info", "Email sent to:<nl/>%1", to) + "</qt>";
msg = QLatin1String("<qt>") + i18nc("@info", "Email sent to:<nl/>%1", to) + QLatin1String("</qt>");
KAMessageBox::information(this, msg);
}
......@@ -1421,7 +1421,7 @@ void EditEmailAlarmDlg::openAddressBook()
Person person(selections.first().name(), selections.first().email());
QString addrs = mEmailToEdit->text().trimmed();
if (!addrs.isEmpty())
addrs += ", ";
addrs += QLatin1String(", ");
addrs += person.fullName();
mEmailToEdit->setText(addrs);
}
......
......@@ -36,7 +36,7 @@ QCheckBox* FileDialog::mAppendCheck = 0;
QString FileDialog::getSaveFileName(const KUrl& dir, const QString& filter, QWidget* parent, const QString& caption, bool* append)
{
bool defaultDir = dir.isEmpty();
bool specialDir = !defaultDir && dir.protocol() == "kfiledialog";
bool specialDir = !defaultDir && dir.protocol() == QLatin1String("kfiledialog");
// Use AutoQPointer to guard against crash on application exit while
// the dialogue is still open. It prevents double deletion (both on
// deletion of parent, and on return from this function).
......
......@@ -189,7 +189,7 @@ void LineEdit::dropEvent(QDropEvent* e)
{
// Remove newlines from a list of email addresses, and allow an eventual mailto: protocol
QString mailto = QLatin1String("mailto:");
newEmails = txt.split(QRegExp("[\r\n]+"), QString::SkipEmptyParts);
newEmails = txt.split(QRegExp(QLatin1String("[\r\n]+")), QString::SkipEmptyParts);
for (QStringList::Iterator it = newEmails.begin(); it != newEmails.end(); ++it)
{
if ((*it).startsWith(mailto))
......@@ -208,12 +208,12 @@ void LineEdit::dropEvent(QDropEvent* e)
if (newEmails.count())
{
newText = newEmails.join(",");
newText = newEmails.join(QLatin1String(","));
int c = cursorPosition();
if (c > 0)
newText.prepend(",");
newText.prepend(QLatin1String(","));
if (c < static_cast<int>(text().length()))
newText.append(",");
newText.append(QLatin1String(","));
}
if (!newText.isEmpty())
insert(newText);
......
......@@ -58,8 +58,8 @@ bool ShellProcess::start(OpenMode openMode)
connect(this, SIGNAL(readyReadStandardOutput()), SLOT(stdoutReady()));
connect(this, SIGNAL(readyReadStandardError()), SLOT(stderrReady()));
QStringList args;
args << "-c" << mCommand;
QProcess::start(shellName(), args, openMode);
args << QLatin1String("-c") << mCommand;
QProcess::start(QLatin1String(shellName()), args, openMode);
if (!waitForStarted())
{
mStatus = START_FAIL;
......@@ -216,7 +216,7 @@ bool ShellProcess::authorised()
{
if (!mInitialised)
{
mAuthorised = KAuthorized::authorizeKAction("shell_access");
mAuthorised = KAuthorized::authorizeKAction(QLatin1String("shell_access"));
mInitialised = true;
}
return mAuthorised;
......
......@@ -248,14 +248,14 @@ QSize TimeSpinBox::sizeHint() const
{
QSize sz = SpinBox2::sizeHint();
QFontMetrics fm(font());
return QSize(sz.width() + fm.width(":"), sz.height());
return QSize(sz.width() + fm.width(QLatin1Char(':')), sz.height());
}
QSize TimeSpinBox::minimumSizeHint() const
{
QSize sz = SpinBox2::minimumSizeHint();
QFontMetrics fm(font());
return QSize(sz.width() + fm.width(":"), sz.height());
return QSize(sz.width() + fm.width(QLatin1Char(':')), sz.height());
}
/******************************************************************************
......
......@@ -30,18 +30,19 @@ TimeZoneCombo::TimeZoneCombo(QWidget* parent)
{
if (!mCatalogLoaded)
{
KGlobal::locale()->insertCatalog( "timezones4" ); // for time zone translations
KGlobal::locale()->insertCatalog( QLatin1String("timezones4") ); // for time zone translations
mCatalogLoaded = true;
}
QString utc = KTimeZone::utc().name();
addItem(utc); // put UTC at start of list
mZoneNames << utc;
const KTimeZones::ZoneMap zones = KSystemTimeZones::zones();
for (KTimeZones::ZoneMap::ConstIterator it = zones.constBegin(); it != zones.constEnd(); ++it)
KTimeZones::ZoneMap::ConstIterator end = zones.constEnd();
for (KTimeZones::ZoneMap::ConstIterator it = zones.constBegin(); it != end; ++it)
if (it.key() != utc)
{
mZoneNames << it.key();
addItem(i18n(it.key().toUtf8()).replace('_', ' '));
addItem(i18n(it.key().toUtf8()).replace(QLatin1Char('_'), QLatin1Char(' ')));
}
}
......
......@@ -141,7 +141,7 @@ int Version()
{
static int version = 0;
if (!version)
version = KAlarmCal::getVersionNumber(KALARM_VERSION);
version = KAlarmCal::getVersionNumber(QLatin1String(KALARM_VERSION));
return version;
}
......
......@@ -60,14 +60,14 @@ class Preferences : public PreferencesBase
static void setWorkDayStart(const QTime& t) { self()->setBase_WorkDayStart(QDateTime(QDate(1900,1,1), t)); }
static void setWorkDayEnd(const QTime& t) { self()->setBase_WorkDayEnd(QDateTime(QDate(1900,1,1), t)); }
static void setWorkDays(const QBitArray&);
static bool quitWarn() { return mUsingDefaults ? self()->base_QuitWarn() : notifying(QUIT_WARN); }
static void setQuitWarn(bool yes) { setNotify(QUIT_WARN, yes); }
static bool confirmAlarmDeletion() { return mUsingDefaults ? self()->base_ConfirmAlarmDeletion() : notifying(CONFIRM_ALARM_DELETION); }
static void setConfirmAlarmDeletion(bool yes){ setNotify(CONFIRM_ALARM_DELETION, yes); }
static bool quitWarn() { return mUsingDefaults ? self()->base_QuitWarn() : notifying(QLatin1String(QUIT_WARN)); }
static void setQuitWarn(bool yes) { setNotify(QLatin1String(QUIT_WARN), yes); }
static bool confirmAlarmDeletion() { return mUsingDefaults ? self()->base_ConfirmAlarmDeletion() : notifying(QLatin1String(CONFIRM_ALARM_DELETION)); }
static void setConfirmAlarmDeletion(bool yes){ setNotify(QLatin1String(CONFIRM_ALARM_DELETION), yes); }
static bool emailCopyToKMail() { return self()->mBase_EmailCopyToKMail && self()->mEmailClient == sendmail; }
static void setEmailCopyToKMail(bool yes) { self()->setBase_EmailCopyToKMail(yes); }
static bool emailQueuedNotify() { return mUsingDefaults ? self()->base_EmailQueuedNotify() : notifying(EMAIL_QUEUED_NOTIFY); }
static void setEmailQueuedNotify(bool yes) { setNotify(EMAIL_QUEUED_NOTIFY, yes); }
static bool emailQueuedNotify() { return mUsingDefaults ? self()->base_EmailQueuedNotify() : notifying(QLatin1String(EMAIL_QUEUED_NOTIFY)); }
static void setEmailQueuedNotify(bool yes) { setNotify(QLatin1String(EMAIL_QUEUED_NOTIFY), yes); }
static MailFrom emailFrom();
static QString emailAddress();
static void setEmailAddress(MailFrom, const QString& address);
......
......@@ -167,7 +167,7 @@ SoundWidget::SoundWidget(bool showPlay, bool showRepeat, QWidget* parent)
{
// File play button
mFilePlay = new QPushButton(box);
mFilePlay->setIcon(SmallIcon("media-playback-start"));
mFilePlay->setIcon(SmallIcon(QLatin1String("media-playback-start")));
connect(mFilePlay, SIGNAL(clicked()), SLOT(playSound()));
mFilePlay->setToolTip(i18nc("@info:tooltip", "Test the sound"));
mFilePlay->setWhatsThis(i18nc("@info:whatsthis", "Play the selected sound file."));
......@@ -183,7 +183,7 @@ SoundWidget::SoundWidget(bool showPlay, bool showRepeat, QWidget* parent)
// File browse button
mFileBrowseButton = new PushButton(box);
mFileBrowseButton->setIcon(KIcon(SmallIcon("document-open")));
mFileBrowseButton->setIcon(KIcon(SmallIcon(QLatin1String("document-open"))));
int size = mFileBrowseButton->sizeHint().height();
mFileBrowseButton->setFixedSize(size, size);
connect(mFileBrowseButton, SIGNAL(clicked()), SLOT(slotPickFile()));
......@@ -438,7 +438,7 @@ void SoundWidget::playSound()
Phonon::createPath(mPlayer, output);
#endif
connect(mPlayer, SIGNAL(finished()), SLOT(playFinished()));
mFilePlay->setIcon(SmallIcon("media-playback-stop")); // change the play button to a stop button
mFilePlay->setIcon(SmallIcon(QLatin1String("media-playback-stop"))); // change the play button to a stop button
mFilePlay->setToolTip(i18nc("@info:tooltip", "Stop sound"));
mFilePlay->setWhatsThis(i18nc("@info:whatsthis", "Stop playing the sound"));
mPlayer->play();
......@@ -451,7 +451,7 @@ void SoundWidget::playFinished()
{
delete mPlayer; // this stops playing if not already stopped
mPlayer = 0;
mFilePlay->setIcon(SmallIcon("media-playback-start"));
mFilePlay->setIcon(SmallIcon(QLatin1String("media-playback-start")));
mFilePlay->setToolTip(i18nc("@info:tooltip", "Test the sound"));
mFilePlay->setWhatsThis(i18nc("@info:whatsthis", "Play the selected sound file."));
}
......
......@@ -92,7 +92,7 @@ SoundPicker::SoundPicker(QWidget* parent)
// Sound file picker button
mFilePicker = new PushButton(this);
mFilePicker->setIcon(KIcon(SmallIcon("audio-x-generic")));
mFilePicker->setIcon(KIcon(SmallIcon(QLatin1String("audio-x-generic"))));
int size = mFilePicker->sizeHint().height();
mFilePicker->setFixedSize(size, size);
connect(mFilePicker, SIGNAL(clicked()), SLOT(slotPickFile()));
......@@ -324,10 +324,10 @@ QString SoundPicker::browseFile(QString& defaultDir, const QString& initialFile)
if (defaultDir.isEmpty())
{
if (kdeSoundDir.isNull())
kdeSoundDir = KGlobal::dirs()->findResourceDir("sound", "KDE-Sys-Warning.ogg");
kdeSoundDir = KGlobal::dirs()->findResourceDir("sound", QLatin1String("KDE-Sys-Warning.ogg"));
defaultDir = kdeSoundDir;
}
QString filter = Phonon::BackendCapabilities::availableMimeTypes().join(" ");
QString filter = Phonon::BackendCapabilities::availableMimeTypes().join(QLatin1String(" "));
return KAlarm::browseFile(i18nc("@title:window", "Choose Sound File"), defaultDir, initialFile, filter, KFile::ExistingOnly, 0);
}
......
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