code cleanup
[fapman] / main.cpp
index e81f3ab..766c0d6 100644 (file)
--- a/main.cpp
+++ b/main.cpp
 #include "mainwindow.h"
 #include "confirmdialog.h"
 
-#include <unistd.h>
-#include <sys/vfs.h>
+extern "C"
+{
+       #include <unistd.h>
+}
 
 bool EnableDebugOutput = false;
 
@@ -56,7 +58,6 @@ int main(int argc, char *argv[])
     w.show();
 #endif
 
-#ifdef Q_WS_MAEMO_5
        uid_t userUID = getuid();
        if( userUID != 0 ) {
                ConfirmDialog d(false, &w);
@@ -64,29 +65,7 @@ int main(int argc, char *argv[])
                d.exec();
        }
 
-       quint64 warn_limit_root = 5120;
-       quint64 warn_limit_opt = 51200;
-       struct statfs root_stat;
-       struct statfs opt_stat;
-       statfs("/",&root_stat);
-       statfs("/opt",&opt_stat);
-       quint64 free_root = root_stat.f_bavail * root_stat.f_bsize / 1024;
-       quint64 free_opt = opt_stat.f_bavail * opt_stat.f_bsize / 1024;
-       qDebug() << "rootfs" << free_root << "kB free";
-       qDebug() << "opt fs" << free_opt << "kB free";
-       if( free_root < warn_limit_root || free_opt < warn_limit_opt )
-       {
-               ConfirmDialog d(false, &w);
-               QString t;
-               if( free_root < warn_limit_root )
-                       t += QString("Root filesystem has %L1 kB available<br>").arg(free_root);
-               if( free_opt < warn_limit_opt )
-                       t += QString("Opt (home) filesystem has %L1 kB available<br>").arg(free_opt);
-               t += "<br>You may proceed, but consider freeing up space to prevent problems in the future";
-               d.setText("Warning: Low disk space",t);
-               d.exec();
-       }
-
+#ifdef Q_WS_MAEMO_5
        // *** from patch by qwerty12 ***
        if (!QDBusConnection::sessionBus().isConnected()) {
                qWarning("Cannot connect to the D-Bus session bus.");
@@ -100,7 +79,6 @@ int main(int argc, char *argv[])
                qWarning("%s", qPrintable(QDBusConnection::sessionBus().lastError().message()));
        }
        // ***
-
 #endif
 
     return a.exec();