[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kget
From: Javier Goday <jgoday () gmail ! com>
Date: 2008-07-31 21:06:19
Message-ID: 1217538379.863321.11047.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 840315 by jgoday:
Use KonqMenuActions to show the possible actions over the finished transfers in the \
contextmenu BUG:110777
M +14 -1 CMakeLists.txt
M +29 -1 ui/contextmenu.cpp
M +10 -10 ui/transfersviewdelegate.cpp
M +0 -3 ui/transfersviewdelegate.h
--- trunk/KDE/kdenetwork/kget/CMakeLists.txt #840314:840315
@@ -18,14 +18,23 @@
endif(PLASMA_FOUND)
+# find kworkspace library to allow the shutdown after downloads completed option
find_library(KDE4_KWORKSPACE_LIBRARY NAMES kworkspace PATHS ${KDE4_LIB_INSTALL_DIR} \
NO_DEFAULT_PATH )
-
if(KDE4_KWORKSPACE_LIBRARY)
set(KDE4_KWORKSPACE_LIBS ${kworkspace_LIB_DEPENDS} ${KDE4_KWORKSPACE_LIBRARY})
add_definitions(-DHAVE_KWORKSPACE)
set(KWORKSPACE_FOUND true)
endif(KDE4_KWORKSPACE_LIBRARY)
+# find libkonq to allow actions and open with options in the context menu of a \
transfer +find_library(KDE4_KONQUEROR_LIBRARY NAMES konq PATHS \
${KDE4_LIB_INSTALL_DIR} NO_DEFAULT_PATH ) +if(KDE4_KONQUEROR_LIBRARY)
+ set(KDE4_KONQUEROR_LIBS ${konq_LIB_DEPENDS} ${KDE4_KONQUEROR_LIBRARY})
+ add_definitions(-DHAVE_KONQUEROR)
+ set(KONQUEROR_FOUND true)
+endif(KDE4_KONQUEROR_LIBRARY)
+
+
include_directories(
${CMAKE_SOURCE_DIR}/kget/core/
${CMAKE_CURRENT_BINARY_DIR}
@@ -156,4 +165,8 @@
target_link_libraries(kget ${KDE4_KDEUI_LIBRARY} ${KDE4_KIO_LIBRARY} \
${KDE4_KNOTIFYCONFIG_LIBRARY} kgetcore)
+if (KONQUEROR_FOUND)
+ target_link_libraries(kget ${KDE4_KONQUEROR_LIBS})
+endif (KONQUEROR_FOUND)
+
install(TARGETS kget ${INSTALL_TARGETS_DEFAULT_ARGS})
--- trunk/KDE/kdenetwork/kget/ui/contextmenu.cpp #840314:840315
@@ -22,6 +22,11 @@
#include <KMenu>
#include <QWidgetAction>
+#ifdef HAVE_KONQUEROR
+ #include <KFileItem>
+ #include <konq_menuactions.h>
+ #include <konq_popupmenuinformation.h>
+#endif
KMenu * ContextMenu::createTransferContextMenu(QList<TransferHandler*> transfers, \
QWidget *parent) {
@@ -74,12 +79,35 @@
popup->addAction( KGet::actionCollection()->action("transfer_open_file") );
popup->addAction( KGet::actionCollection()->action("transfer_show_details") );
popup->addAction( KGet::actionCollection()->action("transfer_copy_source_url") \
); +
return popup;
}
KMenu * ContextMenu::createTransferContextMenu(TransferHandler* handler, QWidget \
*parent) {
- return ContextMenu::createTransferContextMenu(QList<TransferHandler*>() << \
handler, parent); + KMenu *popup = \
ContextMenu::createTransferContextMenu(QList<TransferHandler*>() << handler, parent); \
+ +#ifdef HAVE_KONQUEROR
+ // only shows the open with actions if the transfer is finished
+ if (handler->status() == Job::Finished) {
+ KFileItemList items;
+ items << KFileItem(KFileItem::Unknown, KFileItem::Unknown, handler->dest());
+
+ KonqPopupMenuInformation popupInfo;
+ popupInfo.setItems(items);
+ popupInfo.setParentWidget(parent);
+ KonqMenuActions menuActions;
+ menuActions.setPopupMenuInfo(popupInfo);
+
+ menuActions.addActionsTo(popup);
+ menuActions.addOpenWithActionsTo(popup, "DesktopEntryName != 'kget'");
+
+ // TODO : seems like the popup menu has to be showed while the \
KonqMenuActions instance exists ? + popup->exec(QCursor::pos());
+ }
+#endif
+
+ return popup;
}
KMenu * ContextMenu::createTransferGroupContextMenu(TransferGroupHandler *handler, \
QWidget *parent)
--- trunk/KDE/kdenetwork/kget/ui/transfersviewdelegate.cpp #840314:840315
@@ -271,7 +271,7 @@
}
TransfersViewDelegate::TransfersViewDelegate(QAbstractItemView *parent)
- : KExtendableItemDelegate(parent), m_popup(0)
+ : KExtendableItemDelegate(parent)
{
Q_ASSERT(qobject_cast<QAbstractItemView *>(parent));
setExtendPixmap(SmallIcon("arrow-right"));
@@ -416,11 +416,7 @@
{
// kDebug(5001) << "TransfersViewDelegate::editorEvent() -> rightClick";
- if(m_popup)
- {
- delete(m_popup);
- m_popup = 0;
- }
+ KMenu *popup = 0;
TransferTreeModel * transferTreeModel = static_cast<TransferTreeModel \
*>(model);
@@ -429,7 +425,7 @@
// kDebug(5001) << "isTransferGroup = true";
TransferGroupHandler * transferGroupHandler = \
static_cast<TransferGroupHandler *>(index.internalPointer());
- m_popup = \
ContextMenu::createTransferGroupContextMenu(transferGroupHandler, \
qobject_cast<QWidget*>(this)); + popup = \
ContextMenu::createTransferGroupContextMenu(transferGroupHandler, \
qobject_cast<QWidget*>(this));
}
else
@@ -438,11 +434,15 @@
TransferHandler * transferHandler = static_cast<TransferHandler \
*>(index.internalPointer());
- m_popup = ContextMenu::createTransferContextMenu(transferHandler, \
qobject_cast<QWidget*>(this)); + popup = \
ContextMenu::createTransferContextMenu(transferHandler, \
qobject_cast<QWidget*>(this)); }
- if(m_popup)
- m_popup->popup( mouseEvent->globalPos() );
+ if(popup) {
+ if(!popup->isVisible()) {
+ popup->exec(QCursor::pos());
+ }
+ popup->deleteLater();
+ }
}
}
--- trunk/KDE/kdenetwork/kget/ui/transfersviewdelegate.h #840314:840315
@@ -20,8 +20,6 @@
class QHBoxLayout;
class QButtonGroup;
-class KMenu;
-
class TransferHandler;
class TransfersViewDelegate;
@@ -103,7 +101,6 @@
private:
QWidget *getDetailsWidgetForTransfer(TransferHandler *handler);
- KMenu * m_popup;
QList<QModelIndex> m_editingIndexes;
// QMap<TransferHandler *, QWidget *> m_transfersMap;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic