[Kget] KDE/kdenetwork/kget

Urs Wolfer uwolfer at kde.org
Tue Feb 5 23:01:22 CET 2008


SVN commit 771422 by uwolfer:

New feature for KGet: Webinterface.

The webinterface lets you control your downloads over network and KGet.

Based on QTcpServer. Browser part based on Ajax and JSON (with JavaScript framework MooTools).

This is just initial work; at the moment you are able to list your current downloads and add new ones.

CCMAIL:kget at kde.org

 M  +4 -0      CMakeLists.txt  
 A             conf/dlgwebinterface.cpp   [License: GPL (v2+)]
 A             conf/dlgwebinterface.h   [License: GPL (v2+)]
 A             conf/dlgwebinterface.ui  
 M  +15 -0     conf/kget.kcfg  
 M  +7 -4      conf/preferencesdialog.cpp  
 M  +0 -5      conf/preferencesdialog.h  
 M  +1 -0      extensions/CMakeLists.txt  
 A             extensions/webinterface (directory)  
 A             extensions/webinterface/CMakeLists.txt  
 A             extensions/webinterface/httpserver.cpp   [License: GPL (v2+)]
 A             extensions/webinterface/httpserver.h   [License: GPL (v2+)]
 A             extensions/webinterface/www (directory)  
 A             extensions/webinterface/www/CMakeLists.txt  
 A             extensions/webinterface/www/index.htm  
 A             extensions/webinterface/www/mootools.js  
 M  +15 -1     mainwindow.cpp  
 M  +3 -0      mainwindow.h  


--- trunk/KDE/kdenetwork/kget/CMakeLists.txt #771421:771422
@@ -56,6 +56,7 @@
 
 set(kget_SRCS ${kget_adaptor_SRCS}
    conf/dlgdirectories.cpp
+   conf/dlgwebinterface.cpp
    conf/preferencesdialog.cpp
    conf/transfersgroupwidget.cpp
    conf/selectdirectoryitemdelegate.cpp
@@ -74,12 +75,15 @@
    ui/groupsettingsdialog.cpp
    mainwindow.cpp
    main.cpp
+
+   extensions/webinterface/httpserver.cpp
 )
 
 kde4_add_ui_files(kget_SRCS
    conf/dlgadvanced.ui
    conf/dlgappearance.ui
    conf/dlgdirectories.ui
+   conf/dlgwebinterface.ui
    conf/dlgnetwork.ui
    ui/transferdetailsfrm.ui
    ui/newtransferwidget.ui
--- trunk/KDE/kdenetwork/kget/conf/kget.kcfg #771421:771422
@@ -122,6 +122,21 @@
     </entry>
   </group>
 
+  <group name="Webinterface">
+    <entry name="WebinterfaceEnabled" type="Bool">
+      <default>false</default>
+    </entry>
+    <entry name="WebinterfacePort" type="Int">
+      <default>8080</default>
+    </entry>
+    <entry name="WebinterfaceUser" type="String">
+      <default>admin</default>
+    </entry>
+    <entry name="WebinterfacePassword" type="String">
+      <default>admin</default>
+    </entry>
+  </group>
+
   <group name="Internal">
     <!-- NOT CONFIGURABLE -->
     <entry name="MainPosition" type="Point"/>
--- trunk/KDE/kdenetwork/kget/conf/preferencesdialog.cpp #771421:771422
@@ -12,6 +12,7 @@
 #include "ui_dlgappearance.h"
 #include "ui_dlgnetwork.h"
 #include "dlgdirectories.h"
+#include "dlgwebinterface.h"
 #include "ui_dlgadvanced.h"
 #include "transfersgroupwidget.h"
 
@@ -21,11 +22,12 @@
 PreferencesDialog::PreferencesDialog(QWidget * parent, KConfigSkeleton * skeleton)
     : KConfigDialog(parent, "preferences", skeleton)
 {
-    appearance = new QWidget(this);
-    groups = new QWidget(this);
+    QWidget *appearance = new QWidget(this);
+    QWidget *groups = new QWidget(this);
     DlgDirectories *directories = new DlgDirectories(this);
-    network = new QWidget(this);
-    advanced = new QWidget(this);
+    DlgWebinterface *webinterface = new DlgWebinterface(this);
+    QWidget *network = new QWidget(this);
+    QWidget *advanced = new QWidget(this);
     plugins = new KTabWidget(this);
 
     groups->setLayout(new TransfersGroupWidget());
@@ -48,6 +50,7 @@
     addPage(groups, i18n("Groups"), "bookmarks", i18n("Manage the groups"));
     addPage(directories, i18n("Folders"), "folder", i18n("Default Download Folders"));
     addPage(network, i18n("Network"), "network-workgroup", i18n("Network and Downloads"));
+    addPage(webinterface, i18n("Webinterface"), "network-workgroup", i18n("Control KGet over Network or Internet"));
     addPage(advanced, i18nc("Advanced Options", "Advanced"), "preferences-other", i18n("Advanced Options"));
     addPage(plugins, i18n("Plugins"), "preferences-plugin", i18n("Transfer Plugin Options"));
 
--- trunk/KDE/kdenetwork/kget/conf/preferencesdialog.h #771421:771422
@@ -27,11 +27,6 @@
         void disableButtonApply();
 
     private:
-        QWidget * appearance;
-        QWidget * groups;
-        QWidget * network;
-        QWidget * directories;
-        QWidget * advanced;
         KTabWidget * plugins;
 };
 
--- trunk/KDE/kdenetwork/kget/extensions/CMakeLists.txt #771421:771422
@@ -1 +1,2 @@
 add_subdirectory(konqueror)
+add_subdirectory(webinterface)
--- trunk/KDE/kdenetwork/kget/mainwindow.cpp #771421:771422
@@ -28,6 +28,7 @@
 #include "ui/newtransferdialog.h"
 #include "ui/transferhistory.h"
 #include "ui/groupsettingsdialog.h"
+#include "extensions/webinterface/httpserver.h"
 
 #include <kapplication.h>
 #include <kstandarddirs.h>
@@ -52,7 +53,10 @@
 
 MainWindow::MainWindow(bool showMainwindow, bool startWithoutAnimation, QWidget *parent)
     : KXmlGuiWindow( parent ),
-      m_drop(0), m_dock(0), m_startWithoutAnimation(startWithoutAnimation)
+      m_drop(0),
+      m_dock(0),
+      m_startWithoutAnimation(startWithoutAnimation),
+      m_webinterface(0)
 {
     // do not quit the app when it has been minimized to system tray and a new transfer dialog
     // gets opened and closed again.
@@ -321,6 +325,9 @@
 
     // kget kuiserver integration
     KGet::reloadKJobs();
+
+    if (Settings::webinterfaceEnabled())
+        m_webinterface = new HttpServer(this);
 }
 
 void MainWindow::slotToggleDropTarget()
@@ -590,6 +597,13 @@
         clipboardTimer->stop();
     m_autoPasteAction->setChecked(Settings::autoPaste());
 
+    if (Settings::webinterfaceEnabled() && !m_webinterface) {
+        m_webinterface = new HttpServer(this);
+    } else if (m_webinterface) {
+        delete m_webinterface;
+        m_webinterface = 0;
+    }
+
     KGet::settingsChanged();
 }
 
--- trunk/KDE/kdenetwork/kget/mainwindow.h #771421:771422
@@ -22,6 +22,7 @@
 class ViewsContainer;
 class DropTarget;
 class DBusModelObserver;
+class HttpServer;
 
 /**
  * The main window of KGet.
@@ -127,6 +128,8 @@
     QTimer *clipboardTimer;
 
     bool m_startWithoutAnimation;
+
+    HttpServer *m_webinterface;
 };
 
 #endif


More information about the Kget mailing list