|
Link Here
|
| 44 |
#include <kinputdialog.h> |
44 |
#include <kinputdialog.h> |
| 45 |
#include <tdefiledialog.h> |
45 |
#include <tdefiledialog.h> |
| 46 |
#include <kdesktopfile.h> |
46 |
#include <kdesktopfile.h> |
|
|
47 |
#include <tdeapplication.h> |
| 47 |
#include "konqsidebar.h" |
48 |
#include "konqsidebar.h" |
| 48 |
|
49 |
|
| 49 |
#include "sidebar_widget.h" |
50 |
#include "sidebar_widget.h" |
|
Link Here
|
| 65 |
|
66 |
|
| 66 |
void addBackEnd::aboutToShowAddMenu() |
67 |
void addBackEnd::aboutToShowAddMenu() |
| 67 |
{ |
68 |
{ |
|
|
69 |
TQStringList m_restrictedViews( dynamic_cast<Sidebar_Widget *>( m_parent )->getRestrictedViews() ); |
| 68 |
if (!menu) |
70 |
if (!menu) |
| 69 |
return; |
71 |
return; |
| 70 |
TDEStandardDirs *dirs = TDEGlobal::dirs(); |
72 |
TDEStandardDirs *dirs = TDEGlobal::dirs(); |
| 71 |
TQStringList list = dirs->findAllResources("data","konqsidebartng/add/*.desktop",true,true); |
73 |
TQStringList list; |
|
|
74 |
|
| 75 |
if ( ! m_restrictedViews.empty() ) { |
| 76 |
for ( TQStringList::Iterator it = m_restrictedViews.begin(); it != m_restrictedViews.end(); ++it ) { |
| 77 |
list += dirs->findAllResources("data","konqsidebartng/add/" + *it + ".desktop",true,true); |
| 78 |
} |
| 79 |
} else { |
| 80 |
list = dirs->findAllResources( "data","konqsidebartng/add/*.desktop",true,true ); |
| 81 |
} |
| 72 |
libNames.setAutoDelete(true); |
82 |
libNames.setAutoDelete(true); |
| 73 |
libNames.resize(0); |
83 |
libNames.resize(0); |
| 74 |
libParam.setAutoDelete(true); |
84 |
libParam.setAutoDelete(true); |
|
Link Here
|
| 645 |
|
655 |
|
| 646 |
void Sidebar_Widget::readConfig() |
656 |
void Sidebar_Widget::readConfig() |
| 647 |
{ |
657 |
{ |
| 648 |
m_disableConfig = m_config->readBoolEntry("DisableConfig",false); |
658 |
m_disableConfig = m_config->readBoolEntry("DisableConfig",false); |
| 649 |
m_singleWidgetMode = m_config->readBoolEntry("SingleWidgetMode",true); |
659 |
m_singleWidgetMode = m_config->readBoolEntry("SingleWidgetMode",true); |
| 650 |
m_immutableSingleWidgetMode = |
660 |
m_immutableSingleWidgetMode = m_config->entryIsImmutable("SingleWidgetMode"); |
| 651 |
m_config->entryIsImmutable("SingleWidgetMode"); |
|
|
| 652 |
m_showExtraButtons = m_config->readBoolEntry("ShowExtraButtons",false); |
661 |
m_showExtraButtons = m_config->readBoolEntry("ShowExtraButtons",false); |
| 653 |
m_immutableShowExtraButtons = |
662 |
m_immutableShowExtraButtons = m_config->entryIsImmutable("ShowExtraButtons"); |
| 654 |
m_config->entryIsImmutable("ShowExtraButtons"); |
|
|
| 655 |
m_showTabsLeft = m_config->readBoolEntry("ShowTabsLeft", true); |
663 |
m_showTabsLeft = m_config->readBoolEntry("ShowTabsLeft", true); |
| 656 |
m_immutableShowTabsLeft = m_config->entryIsImmutable("ShowTabsLeft"); |
664 |
m_immutableShowTabsLeft = m_config->entryIsImmutable("ShowTabsLeft"); |
| 657 |
m_hideTabs = m_config->readBoolEntry("HideTabs", false); |
665 |
m_hideTabs = m_config->readBoolEntry("HideTabs", false); |
| 658 |
m_immutableHideTabs = m_config->entryIsImmutable("HideTabs"); |
666 |
m_immutableHideTabs = m_config->entryIsImmutable("HideTabs"); |
|
|
667 |
m_restrictedViews = m_config->readListEntry( "RestrictViews" ); |
| 659 |
|
668 |
|
| 660 |
if (m_initial) { |
669 |
if (m_initial) { |
| 661 |
m_openViews = m_config->readListEntry("OpenViews"); |
670 |
m_openViews = m_config->readListEntry("OpenViews"); |
|
Link Here
|
| 722 |
{ |
731 |
{ |
| 723 |
kdDebug()<<"m_path: "<<m_path<<endl; |
732 |
kdDebug()<<"m_path: "<<m_path<<endl; |
| 724 |
TQDir dir(m_path); |
733 |
TQDir dir(m_path); |
| 725 |
TQStringList list=dir.entryList("*.desktop"); |
734 |
TQStringList list; |
|
|
735 |
|
| 736 |
if ( ! m_restrictedViews.empty() ) { |
| 737 |
for ( TQStringList::Iterator it = m_restrictedViews.begin(); it != m_restrictedViews.end(); ++it ) { |
| 738 |
list += dir.entryList( *it + ".desktop"); |
| 739 |
} |
| 740 |
} else { |
| 741 |
list = dir.entryList("*.desktop"); |
| 742 |
} |
| 743 |
|
| 726 |
for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it) |
744 |
for (TQStringList::Iterator it=list.begin(); it!=list.end(); ++it) |
| 727 |
{ |
745 |
{ |
|
|
746 |
kdDebug() << "Sidebar buttons: " << *it << endl; |
| 728 |
addButton(*it); |
747 |
addButton(*it); |
| 729 |
} |
748 |
} |
| 730 |
} |
749 |
} |
|
Link Here
|
| 833 |
|
852 |
|
| 834 |
bool Sidebar_Widget::eventFilter(TQObject *obj, TQEvent *ev) |
853 |
bool Sidebar_Widget::eventFilter(TQObject *obj, TQEvent *ev) |
| 835 |
{ |
854 |
{ |
| 836 |
|
855 |
if ( kapp->authorize( "action/konqsidebarmenu" ) ) { |
| 837 |
if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) |
856 |
if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) |
| 838 |
{ |
|
|
| 839 |
KMultiTabBarTab *bt=tqt_dynamic_cast<KMultiTabBarTab*>(obj); |
| 840 |
if (bt) |
| 841 |
{ |
857 |
{ |
| 842 |
kdDebug()<<"Request for popup"<<endl; |
858 |
KMultiTabBarTab *bt=tqt_dynamic_cast<KMultiTabBarTab*>(obj); |
| 843 |
m_currentButton = 0; |
859 |
if (bt) |
| 844 |
for (uint i=0;i<m_buttons.count();i++) |
|
|
| 845 |
{ |
860 |
{ |
| 846 |
if (bt==m_buttonBar->tab(i)) |
861 |
kdDebug()<<"Request for popup"<<endl; |
|
|
862 |
m_currentButton = 0; |
| 863 |
for (uint i=0;i<m_buttons.count();i++) |
| 847 |
{ |
864 |
{ |
| 848 |
m_currentButton = m_buttons.at(i); |
865 |
if (bt==m_buttonBar->tab(i)) |
| 849 |
break; |
866 |
{ |
|
|
867 |
m_currentButton = m_buttons.at(i); |
| 868 |
break; |
| 869 |
} |
| 850 |
} |
870 |
} |
| 851 |
} |
|
|
| 852 |
|
871 |
|
| 853 |
if (m_currentButton) |
872 |
if (m_currentButton) |
| 854 |
{ |
|
|
| 855 |
if (!m_buttonPopup) |
| 856 |
{ |
873 |
{ |
| 857 |
m_buttonPopup=new TDEPopupMenu(this, "Sidebar_Widget::ButtonPopup"); |
874 |
if (!m_buttonPopup) |
| 858 |
m_buttonPopup->insertTitle(SmallIcon("unknown"), "", 50); |
875 |
{ |
| 859 |
m_buttonPopup->insertItem(SmallIconSet("text"), i18n("Set Name..."),4); // Item to open a dialog to change the name of the sidebar item (by Pupeno) |
876 |
m_buttonPopup=new TDEPopupMenu(this, "Sidebar_Widget::ButtonPopup"); |
| 860 |
m_buttonPopup->insertItem(SmallIconSet("www"), i18n("Set URL..."),2); |
877 |
m_buttonPopup->insertTitle(SmallIcon("unknown"), "", 50); |
| 861 |
m_buttonPopup->insertItem(SmallIconSet("icons"), i18n("Set Icon..."),1); |
878 |
m_buttonPopup->insertItem(SmallIconSet("text"), i18n("Set Name..."),4); // Item to open a dialog to change the name of the sidebar item (by Pupeno) |
| 862 |
m_buttonPopup->insertSeparator(); |
879 |
m_buttonPopup->insertItem(SmallIconSet("www"), i18n("Set URL..."),2); |
| 863 |
m_buttonPopup->insertItem(SmallIconSet("editdelete"), i18n("Remove"),3); |
880 |
m_buttonPopup->insertItem(SmallIconSet("icons"), i18n("Set Icon..."),1); |
| 864 |
m_buttonPopup->insertSeparator(); |
881 |
m_buttonPopup->insertSeparator(); |
| 865 |
m_buttonPopup->insertItem(SmallIconSet("configure"), i18n("Configure Navigation Panel"), m_menu, 4); |
882 |
m_buttonPopup->insertItem(SmallIconSet("editdelete"), i18n("Remove"),3); |
| 866 |
connect(m_buttonPopup, TQT_SIGNAL(activated(int)), |
883 |
m_buttonPopup->insertSeparator(); |
| 867 |
this, TQT_SLOT(buttonPopupActivate(int))); |
884 |
m_buttonPopup->insertItem(SmallIconSet("configure"), i18n("Configure Navigation Panel"), m_menu, 4); |
|
|
885 |
connect(m_buttonPopup, TQT_SIGNAL(activated(int)), |
| 886 |
this, TQT_SLOT(buttonPopupActivate(int))); |
| 887 |
} |
| 888 |
m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty()); |
| 889 |
m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName), |
| 890 |
m_currentButton->displayName); |
| 891 |
if (!m_disableConfig) |
| 892 |
{ m_buttonPopup->exec(TQCursor::pos()); } |
| 868 |
} |
893 |
} |
| 869 |
m_buttonPopup->setItemEnabled(2,!m_currentButton->URL.isEmpty()); |
894 |
return true; |
| 870 |
m_buttonPopup->changeTitle(50,SmallIcon(m_currentButton->iconName), |
|
|
| 871 |
m_currentButton->displayName); |
| 872 |
if (!m_disableConfig) |
| 873 |
{ m_buttonPopup->exec(TQCursor::pos()); } |
| 874 |
} |
| 875 |
return true; |
| 876 |
|
895 |
|
|
|
896 |
} |
| 877 |
} |
897 |
} |
| 878 |
} |
898 |
} |
| 879 |
return false; |
899 |
return false; |
|
Link Here
|
| 881 |
|
901 |
|
| 882 |
void Sidebar_Widget::mousePressEvent(TQMouseEvent *ev) |
902 |
void Sidebar_Widget::mousePressEvent(TQMouseEvent *ev) |
| 883 |
{ |
903 |
{ |
| 884 |
if (ev->type()==TQEvent::MouseButtonPress && |
904 |
if ( kapp->authorize( "action/konqsidebarmenu" ) ) { |
| 885 |
((TQMouseEvent *)ev)->button()==Qt::RightButton && |
905 |
if (ev->type()==TQEvent::MouseButtonPress && ((TQMouseEvent *)ev)->button()==Qt::RightButton) { |
| 886 |
!m_disableConfig) |
906 |
m_menu->exec(TQCursor::pos()); |
| 887 |
{ m_menu->exec(TQCursor::pos()); } |
907 |
} |
|
|
908 |
} |
| 888 |
} |
909 |
} |
| 889 |
|
910 |
|
| 890 |
KonqSidebarPlugin *Sidebar_Widget::loadModule(TQWidget *par,TQString &desktopName,TQString lib_name,ButtonInfo* bi) |
911 |
KonqSidebarPlugin *Sidebar_Widget::loadModule(TQWidget *par,TQString &desktopName,TQString lib_name,ButtonInfo* bi) |