Use QFileInfo::exists(...) static method

wilder-work
Montel Laurent 9 years ago
parent b172bf43fd
commit 0054d4e8ef
  1. 6
      src/identity/identitydialog.cpp
  2. 4
      src/identity/identityeditvcarddialog.cpp

@ -953,7 +953,7 @@ void IdentityDialog::setIdentity(KIdentityManagement::Identity &ident)
} else {
//Convert path.
const QString path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QLatin1Char('/') + ident.identityName() + QLatin1String(".vcf");
if (QFile(path).exists() && (mVcardFilename != path)) {
if (QFileInfo::exists(path) && (mVcardFilename != path)) {
mVcardFilename = path;
}
}
@ -1056,7 +1056,7 @@ void IdentityDialog::updateIdentity(KIdentityManagement::Identity &ident)
}
void IdentityDialog::slotEditVcard()
{
if (QFile(mVcardFilename).exists()) {
if (QFileInfo::exists(mVcardFilename)) {
editVcard(mVcardFilename);
} else {
if (!MailCommon::Kernel::self()->kernelIsRegistered()) {
@ -1113,7 +1113,7 @@ void IdentityDialog::slotVCardRemoved()
void IdentityDialog::updateVcardButton()
{
if (mVcardFilename.isEmpty() || !QFile(mVcardFilename).exists()) {
if (mVcardFilename.isEmpty() || !QFileInfo::exists(mVcardFilename)) {
mEditVCard->setText(i18n("Create..."));
} else {
mEditVCard->setText(i18n("Edit..."));

@ -25,7 +25,7 @@
#include <QStandardPaths>
#include <QHBoxLayout>
#include <QFile>
#include <QFileInfo>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
@ -46,7 +46,7 @@ IdentityEditVcardDialog::IdentityEditVcardDialog(const QString &fileName, QWidge
connect(buttonBox, &QDialogButtonBox::accepted, this, &IdentityEditVcardDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &IdentityEditVcardDialog::reject);
if (QFile(fileName).exists()) {
if (QFileInfo::exists(fileName)) {
setWindowTitle(i18n("Edit own vCard"));
QPushButton *user1Button = new QPushButton;
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);

Loading…
Cancel
Save