Changeset View
Changeset View
Standalone View
Standalone View
src/uploaddialog.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 53 | { | |||
---|---|---|---|---|---|
76 | buttonBox->addButton(nextButton, QDialogButtonBox::ActionRole); | 76 | buttonBox->addButton(nextButton, QDialogButtonBox::ActionRole); | ||
77 | buttonBox->addButton(finishButton, QDialogButtonBox::AcceptRole); | 77 | buttonBox->addButton(finishButton, QDialogButtonBox::AcceptRole); | ||
78 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel); | 78 | buttonBox->setStandardButtons(QDialogButtonBox::Cancel); | ||
79 | layout->addWidget(buttonBox); | 79 | layout->addWidget(buttonBox); | ||
80 | 80 | | |||
81 | atticaHelper = new KNSCore::AtticaHelper(q); | 81 | atticaHelper = new KNSCore::AtticaHelper(q); | ||
82 | 82 | | |||
83 | bool success = true; | 83 | bool success = true; | ||
84 | KConfig conf(configfile); | 84 | QFileInfo fi(configfile); | ||
85 | if (conf.accessMode() == KConfig::NoAccess) { | 85 | if (!fi.exists()) { | ||
86 | qCritical() << "No knsrc file named '" << configfile << "' was found." << endl; | 86 | if (!fi.isAbsolute()) | ||
87 | fi.setFile(QStandardPaths::locate(QStandardPaths::GenericConfigLocation, configfile)); | ||||
88 | if (!fi.exists()) { | ||||
89 | qCritical() << "No knsrc file named '" << fi.absoluteFilePath() << "' was found." << endl; | ||||
87 | success = false; | 90 | success = false; | ||
88 | } | 91 | } | ||
89 | // KConfig does not actually tell us whether the config file exists, so | 92 | } | ||
90 | // we check ourselves for better error messages. | 93 | | ||
91 | if (QStandardPaths::locate(QStandardPaths::GenericConfigLocation, configfile).isEmpty()) { | 94 | KConfig conf(fi.absoluteFilePath()); | ||
92 | qCritical() << "No knsrc file named '" << configfile << "' was found." << endl; | 95 | if (conf.accessMode() == KConfig::NoAccess) { | ||
96 | qCritical() << "Knsrc file named '" << fi.absoluteFilePath() << "' could not be accessed." << endl; | ||||
93 | success = false; | 97 | success = false; | ||
94 | } | 98 | } | ||
95 | 99 | | |||
96 | KConfigGroup group; | 100 | KConfigGroup group; | ||
97 | if (conf.hasGroup("KNewStuff3")) { | 101 | if (conf.hasGroup("KNewStuff3")) { | ||
98 | qCDebug(KNEWSTUFF) << "Loading KNewStuff3 config: " << configfile; | 102 | qCDebug(KNEWSTUFF) << "Loading KNewStuff3 config: " << fi.absoluteFilePath(); | ||
99 | group = conf.group("KNewStuff3"); | 103 | group = conf.group("KNewStuff3"); | ||
100 | } else { | 104 | } else { | ||
101 | qCritical() << "A knsrc file was found but it doesn't contain a KNewStuff3 section." << endl; | 105 | qCritical() << "A knsrc file was found but it doesn't contain a KNewStuff3 section." << endl; | ||
102 | success = false; | 106 | success = false; | ||
103 | } | 107 | } | ||
104 | 108 | | |||
105 | if (success) { | 109 | if (success) { | ||
106 | const QString providersFileUrl = group.readEntry("ProvidersUrl", QString()); | 110 | const QString providersFileUrl = group.readEntry("ProvidersUrl", QString()); | ||
▲ Show 20 Lines • Show All 749 Lines • Show Last 20 Lines |