summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fbbrowser.cpp17
-rw-r--r--src/fbgui.cpp20
-rw-r--r--src/fbgui.h1
3 files changed, 7 insertions, 31 deletions
diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp
index 42bbe9a..1048d46 100644
--- a/src/fbbrowser.cpp
+++ b/src/fbbrowser.cpp
@@ -12,22 +12,15 @@ fbbrowser::fbbrowser(const QUrl & url)
// Create QNetworkAccessManager which is needed to send/receive requests.
manager = new QNetworkAccessManager(this);
// Create a QNetworkRequest object and set its URL.
- //* QNetworkRequest request;
request.setUrl(url);
- // Check Internet connection
// Let the manager send the request and receive the reply.
- // QNetworkReply *reply = manager->get(request);
- reply = manager->get(request);
- // connect(reply, SIGNAL(finished()), this, SLOT(httpReqFinished()));
-
- // Check if the reply is an error message.
- qDebug() << "QNetworkReply error code is: " << reply->error();
+ reply = manager->get(request);
// TODO: error differentiation
- // reply->error() returns 0 even for invalid URL.
- // A possibility to check for validity, is to listen to readyRead()
- // signal, haven't found a better way yet ...
+ // reply->error() returns 0 even for invalid URL.
+ // A possibility to check for validity, is to listen to readyRead()
+ // signal, haven't found a better way yet ...
if(reply->error() == QNetworkReply::NoError)
{
qDebug() << "No error, loading given URL...";
@@ -35,12 +28,12 @@ fbbrowser::fbbrowser(const QUrl & url)
}
else
{
+ qDebug() << "QNetworkReply error code is: " << reply->error();
qDebug() << "Error occured, loading error page...";
view->load(QUrl("qrc:/html/errorPage.html"));
}
// **** TEST ****
DownloadManager* dm = new DownloadManager(baseUrl);
- // dm->setUrl(baseUrl);
QString qs = "test.php";
dm->downloadFile(qs);
// **** TEST ****
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 1fb50c0..103ad44 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -20,20 +20,6 @@ void printUsage()
exit(1);
}
-// This function returns the path of the application as a QString.
-QString getPath()
-{
- // Alternative 1
- QDir qdir;
- return qdir.currentPath();
- // Alternative 2
- /*
- char result[ PATH_MAX ];
- readlink("/proc/self/exe", result, PATH_MAX);
- return QString(result);
- */
-}
-
int main(int argc, char *argv[])
{
// Parse command line arguments.
@@ -63,15 +49,13 @@ int main(int argc, char *argv[])
}
opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
}
- // Get the application path and prints on screen.
- qDebug() << "Application Path: " << getPath();
-
// This is the main object of a QT Application.
QApplication a(argc, argv);
+ // Get the application path and prints on screen.
+ qDebug() << "Application Path: " << a.applicationDirPath();
// Is this really needed, since we kill the app through the fbbrowser object?
QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
// This part reads the URL to load from the arguments given through the commandline.
- qDebug() << "Number of Arguments:" << argc << endl;
QUrl url;
if (argc > 1)
url = QUrl(argv[1]);
diff --git a/src/fbgui.h b/src/fbgui.h
index 6de7016..4d387a6 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -15,7 +15,6 @@ public:
fbgui();
~fbgui();
void printUsage();
- QString getPath(const char* c);
//private: