Warning, file /frameworks/kio/tests/kionetrctest.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #include <QApplication> 0002 #include <QDebug> 0003 0004 #include "authinfo.h" 0005 0006 void output(const QUrl &u) 0007 { 0008 qDebug() << "Looking up auto login for: " << u; 0009 KIO::NetRC::AutoLogin l; 0010 bool result = KIO::NetRC::self()->lookup(u, l, true); 0011 if (!result) { 0012 qDebug() << "Either no .netrc and/or .kionetrc file was " 0013 "found or there was problem when attempting to " 0014 "read from them! Please make sure either or both " 0015 "of the above files exist and have the correct " 0016 "permission, i.e. a regular file owned by you with " 0017 "with a read/write permission (0600)"; 0018 return; 0019 } 0020 0021 qDebug() << "Type: " << l.type << "\nMachine: " << l.machine << "\nLogin: " << l.login << "\nPassword: " << l.password; 0022 0023 QMap<QString, QStringList>::ConstIterator it = l.macdef.constBegin(); 0024 for (; it != l.macdef.constEnd(); ++it) { 0025 qDebug() << "Macro: " << it.key() << "= " << it.value().join(QLatin1String(" ")); 0026 } 0027 } 0028 0029 int main(int argc, char **argv) 0030 { 0031 // KCmdLineOptions options; 0032 // options.add("+command", qi18n("[url1,url2 ,...]")); 0033 0034 // KCmdLineArgs::init( argc, argv, "kionetrctest", 0, qi18n("KIO-netrc-test"), version, qi18n("Unit test for .netrc and kionetrc parser.")); 0035 QApplication app(argc, argv); 0036 0037 int count = QCoreApplication::arguments().count() - 1; 0038 for (int i = 0; i < count; i++) { 0039 QUrl u = QUrl::fromUserInput(QCoreApplication::arguments().at(i + 1)); 0040 if (!u.isValid()) { 0041 qDebug() << u << "is invalid! Ignoring..."; 0042 continue; 0043 } 0044 output(u); 0045 } 0046 return 0; 0047 }