[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/make_kget_cool/kget
From:       Dario Massarin <nekkar () libero ! it>
Date:       2006-12-29 18:53:41
Message-ID: 1167418421.370706.18647.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 617625 by dario:

* Add a Transfers menu entry in which to put the scheduler commands
actions
* In the same menu entry add an "edit Groups" action which opens a
dialog that allows the user to add or remove transfer groups.



 M  +2 -0      CMakeLists.txt  
 M  +8 -2      core/kget.cpp  
 M  +6 -2      core/kget.h  
 M  +12 -0     mainwindow.cpp  
 M  +3 -0      mainwindow.h  
 A             ui/groupseditdialog.cpp   [License: GPL]
 A             ui/groupseditdialog.h   [License: GPL]
 A             ui/groupseditdialog.ui  
 M  +6 -0      ui/kgetui.rc  
 M  +1 -1      ui/viewscontainer.cpp  


--- branches/work/make_kget_cool/kget/CMakeLists.txt #617624:617625
@@ -63,6 +63,7 @@
 #    ${CMAKE_SOURCE_DIR}/kget/ui/mainview.cpp
    ${CMAKE_SOURCE_DIR}/kget/ui/transfersview.cpp
    ${CMAKE_SOURCE_DIR}/kget/ui/transfersviewdelegate.cpp
+   ${CMAKE_SOURCE_DIR}/kget/ui/groupseditdialog.cpp
 #    ${CMAKE_SOURCE_DIR}/kget/ui/sidebar.cpp
    ${CMAKE_SOURCE_DIR}/kget/ui/splash.cpp
    ${CMAKE_SOURCE_DIR}/kget/ui/transferdetails.cpp
@@ -77,6 +78,7 @@
 
 kde4_add_ui_files(kget_SRCS
    ${CMAKE_SOURCE_DIR}/kget/ui/transferdetailsfrm.ui
+   ${CMAKE_SOURCE_DIR}/kget/ui/groupseditdialog.ui
 )
 
 kde4_automoc(${kget_SRCS})
--- branches/work/make_kget_cool/kget/core/kget.cpp #617624:617625
@@ -71,16 +71,22 @@
     m_observers.removeAll(observer);
 }
 
-void KGet::addGroup(const QString& groupName)
+bool KGet::addGroup(const QString& groupName)
 {
     kDebug(5001) << "KGet::addGroup" << endl;
 
+    // Check if a group with that name already exists
+    if(m_transferTreeModel->findGroup(groupName))
+        return false;
+
     TransferGroup * group = new TransferGroup(m_transferTreeModel, m_scheduler, groupName);
 
     m_transferTreeModel->addGroup(group);
 
     //post notifications
     postAddedTransferGroupEvent(group);
+
+    return true;
 }
 
 void KGet::delGroup(const QString& groupName)
@@ -247,7 +253,7 @@
     return m_selectionModel;
 }
 
-void KGet::addTransferTreeView(QAbstractItemView * view)
+void KGet::addTransferView(QAbstractItemView * view)
 {
     view->setModel(m_transferTreeModel);
 }
--- branches/work/make_kget_cool/kget/core/kget.h #617624:617625
@@ -80,8 +80,12 @@
          * Adds a new group to the KGet.
          *
          * @param groupName The name of the new group
+         *
+         * @returns true if the group has been successully added, otherwise
+         *          it returns false, probably because a group with that named
+         *          already exists
          */
-        static void addGroup(const QString& groupName);
+        static bool addGroup(const QString& groupName);
 
         /**
          * Removes a group from the KGet.
@@ -180,7 +184,7 @@
         /**
          * Sets the given view to the TransferTreeModel object
          */
-        static void addTransferTreeView(QAbstractItemView * view);
+        static void addTransferView(QAbstractItemView * view);
 
         /**
          * Adds a Settings tab for every plugins that needs one
--- branches/work/make_kget_cool/kget/mainwindow.cpp #617624:617625
@@ -40,6 +40,7 @@
 #include "ui/viewscontainer.h"
 #include "ui/tray.h"
 #include "ui/droptarget.h"
+#include "ui/groupseditdialog.h"
 
 MainWindow::MainWindow( QWidget * parent )
     : KMainWindow( parent ),
@@ -129,6 +130,10 @@
     r1->setChecked( Settings::downloadAtStartup() );
     r2->setChecked( !Settings::downloadAtStartup() );
 
+    KAction * r3 = new KAction( KIcon("transfers_list"), i18n("Edit Groups.."),
+                                ac, "edit_groups");
+    connect(r3, SIGNAL(triggered(bool)), SLOT(slotEditGroups()));
+
     m_AutoPaste =  new KToggleAction( KIcon("tool_clipboard"), i18n("Auto-Paste Mode"),
                                       ac, "auto_paste" );
     connect(m_AutoPaste, SIGNAL(triggered(bool)), SLOT(slotToggleAutoPaste()));
@@ -304,6 +309,13 @@
         KGet::save(filename);
 }
 
+void MainWindow::slotEditGroups()
+{
+    GroupsEditDialog dialog;
+
+    dialog.exec();
+}
+
 void MainWindow::slotStartDownload()
 {
     m_dock->setDownloading(true);
--- branches/work/make_kget_cool/kget/mainwindow.h #617624:617625
@@ -61,6 +61,7 @@
     void slotQuit();
     void slotPreferences();
     void slotExportTransfers();
+    void slotEditGroups();
     void slotStartDownload();
     void slotStopDownload();
     void slotConfigureNotifications();
@@ -104,6 +105,8 @@
     // separated widgets
     DropTarget    * m_drop;
     Tray          * m_dock;
+
+    // actions
     KToggleAction * m_showDropTarget;
     KToggleAction * m_AutoPaste;
     KAction       * m_KonquerorIntegration;
--- branches/work/make_kget_cool/kget/ui/kgetui.rc #617624:617625
@@ -9,6 +9,12 @@
         <Separator/>
         <Action name="quit"/>
     </Menu>
+        <Menu noMerge="1" name="Transfers"><text>&amp;Transfers</text>
+        <Action name="start_download"/>
+        <Action name="stop_download"/>
+        <Separator/>
+        <Action name="edit_groups"/>
+    </Menu>
    <Menu name="settings"><text>&amp;Settings</text>
         <Separator/>
         <Action name="configure_notifications"/>
--- branches/work/make_kget_cool/kget/ui/viewscontainer.cpp #617624:617625
@@ -214,7 +214,7 @@
     m_transfersView = new TransfersView();
     m_transfersViewDelegate = new TransfersViewDelegate();
     m_transfersView->setItemDelegate(m_transfersViewDelegate);
-    KGet::addTransferTreeView(m_transfersView);
+    KGet::addTransferView(m_transfersView);
     m_transfersView->setSelectionModel(KGet::selectionModel());
     m_transfersView->setSelectionMode(QAbstractItemView::ExtendedSelection);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic