From kde-devel Thu Oct 28 03:04:21 2004 From: Andre Moreira Magalhaes Date: Thu, 28 Oct 2004 03:04:21 +0000 To: kde-devel Subject: [PATCH] Bug 58580 - Konqueror sidebar settings not stored in profile Message-Id: <20041028030421.36822.qmail () web51903 ! mail ! yahoo ! com> X-MARC-Message: https://marc.info/?l=kde-devel&m=109893335407943 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--0-1306925287-1098932661=:12759" --0-1306925287-1098932661=:12759 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline I have fixed the bug 58580, and i would like to know what you think about. I really believe that the sidebar need a rewrite but anyway the patch fix the bug. i have done another patches including a new sidebar look. if somebody want to take a look, the link is: http://www.kde-apps.org/content/show.php?content=16962 ok to commit? cheers Andrunko __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-1306925287-1098932661=:12759 Content-Type: text/x-diff; name="bug58580.diff" Content-Description: bug58580.diff Content-Disposition: inline; filename="bug58580.diff" Index: konqueror/konq_mainwindow.cc =================================================================== RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v retrieving revision 1.1364 diff -u -p -r1.1364 konq_mainwindow.cc --- konqueror/konq_mainwindow.cc 21 Oct 2004 14:14:47 -0000 1.1364 +++ konqueror/konq_mainwindow.cc 28 Oct 2004 01:56:21 -0000 @@ -4193,6 +4193,11 @@ QString KonqExtendedBookmarkOwner::curre return m_pKonqMainWindow->currentURL(); } +QString KonqMainWindow::currentProfile() const +{ + return m_pViewManager->currentProfile(); +} + QString KonqMainWindow::currentURL() const { if ( !m_currentView ) Index: konqueror/konq_mainwindow.h =================================================================== RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v retrieving revision 1.440 diff -u -p -r1.440 konq_mainwindow.h --- konqueror/konq_mainwindow.h 12 Sep 2004 22:02:55 -0000 1.440 +++ konqueror/konq_mainwindow.h 28 Oct 2004 01:56:21 -0000 @@ -93,6 +93,7 @@ class KonqMainWindow : public KParts::Ma Q_PROPERTY( QString currentTitle READ currentTitle ) Q_PROPERTY( QString currentURL READ currentURL ) Q_PROPERTY( bool isHTMLAllowed READ isHTMLAllowed ) + Q_PROPERTY( QString currentProfile READ currentProfile ) public: enum ComboAction { ComboClear, ComboAdd, ComboRemove }; @@ -297,6 +298,7 @@ public: QString currentTitle() const; QString currentURL() const; + QString currentProfile() const; QStringList configModules() const; Index: konqueror/profile_filemanagement.desktop =================================================================== RCS file: /home/kde/kdebase/konqueror/profile_filemanagement.desktop,v retrieving revision 1.166 diff -u -p -r1.166 profile_filemanagement.desktop --- konqueror/profile_filemanagement.desktop 27 Oct 2004 02:59:56 -0000 1.166 +++ konqueror/profile_filemanagement.desktop 28 Oct 2004 01:56:21 -0000 @@ -70,7 +70,6 @@ Name[xx]=xxFile Managementxx Name[zh_TW]=檔案管理 Name[zu]=Ukuphathwa kwamafayela RootItem=Container0 -View1__OpenViews=services.desktop View1_LinkedView=true View1_PassiveMode=true View1_ServiceName=konq_sidebartng Index: konqueror/profile_filepreview.desktop =================================================================== RCS file: /home/kde/kdebase/konqueror/profile_filepreview.desktop,v retrieving revision 1.122 diff -u -p -r1.122 profile_filepreview.desktop --- konqueror/profile_filepreview.desktop 27 Oct 2004 02:59:56 -0000 1.122 +++ konqueror/profile_filepreview.desktop 28 Oct 2004 01:56:21 -0000 @@ -70,7 +70,6 @@ Name[xx]=xxFile Previewxx Name[zh_TW]=檔案預覽 Name[zu]=Umbukiso wangaphambili wefayela RootItem=Container0 -View1__OpenViews=home.desktop View1_LinkedView=true View1_LockedLocation=false View1_PassiveMode=true Index: konqueror/sidebar/Makefile.am =================================================================== RCS file: /home/kde/kdebase/konqueror/sidebar/Makefile.am,v retrieving revision 1.26 diff -u -p -r1.26 Makefile.am --- konqueror/sidebar/Makefile.am 2 Feb 2004 10:42:00 -0000 1.26 +++ konqueror/sidebar/Makefile.am 28 Oct 2004 01:56:22 -0000 @@ -39,3 +39,6 @@ partrc_DATA = konqsidebartng.rc versiondir = $(kde_datadir)/konqsidebartng/entries/ version_DATA=.version +updatedir = $(kde_datadir)/kconf_update +update_DATA = konqsidebartng.upd +update_SCRIPTS = move_konqsidebartng_entries.sh Index: konqueror/sidebar/konqsidebar.cpp =================================================================== RCS file: /home/kde/kdebase/konqueror/sidebar/konqsidebar.cpp,v retrieving revision 1.27 diff -u -p -r1.27 konqsidebar.cpp --- konqueror/sidebar/konqsidebar.cpp 2 Feb 2004 10:42:00 -0000 1.27 +++ konqueror/sidebar/konqsidebar.cpp 28 Oct 2004 01:56:22 -0000 @@ -29,7 +29,7 @@ KonqSidebar::KonqSidebar( QWidget *paren setInstance( KonqSidebarFactory::instance() ); m_extension = 0; // this should be your custom internal widget - m_widget = new Sidebar_Widget( parentWidget,this, widgetName ,universalMode); + m_widget = new Sidebar_Widget( parentWidget, this, widgetName ,universalMode, parentWidget->topLevelWidget()->property("currentProfile").toString() ); m_extension = new KonqSidebarBrowserExtension( this, m_widget,"KonqSidebar::BrowserExtension" ); connect(m_widget,SIGNAL(started(KIO::Job *)), this, SIGNAL(started(KIO::Job*))); Index: konqueror/sidebar/konqsidebartng.rc =================================================================== RCS file: /home/kde/kdebase/konqueror/sidebar/konqsidebartng.rc,v retrieving revision 1.4 diff -u -p -r1.4 konqsidebartng.rc --- konqueror/sidebar/konqsidebartng.rc 21 Nov 2001 15:20:53 -0000 1.4 +++ konqueror/sidebar/konqsidebartng.rc 28 Oct 2004 01:56:22 -0000 @@ -1,2 +1,7 @@ +[filemanagement] OpenViews=home.desktop SingleWidgetMode=true + +[webbrowsing] +OpenViews=bookmarks.desktop +SingleWidgetMode=true Index: konqueror/sidebar/konqsidebartng.upd =================================================================== RCS file: konqueror/sidebar/konqsidebartng.upd diff -N konqueror/sidebar/konqsidebartng.upd --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ konqueror/sidebar/konqsidebartng.upd 28 Oct 2004 01:56:22 -0000 @@ -0,0 +1,12 @@ +Id=konqsidebartng_rc +File=konqsidebartng.rc +Group=,webbrowsing +Options=Copy +AllKeys +Group=,filemanagement +Options=Copy +AllKeys +RemoveGroup= + +Id=konqsidebartng_entries +Script=move_konqsidebartng_entries.sh,sh Index: konqueror/sidebar/move_konqsidebartng_entries.sh =================================================================== RCS file: konqueror/sidebar/move_konqsidebartng_entries.sh diff -N konqueror/sidebar/move_konqsidebartng_entries.sh --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ konqueror/sidebar/move_konqsidebartng_entries.sh 28 Oct 2004 01:56:22 -0000 @@ -0,0 +1,18 @@ +#!/bin/sh + +prefix=$(kde-config --localprefix) +source="$prefix/share/apps/konqsidebartng" + +[ -d "$source/entries" ] || exit 0 + +profiles="filemanagement webbrowsing" +for profile in $profiles; do + dest="$source/$profile/entries" + if [ ! -d "$dest" ]; then + mkdir -p "$dest" || exit 1 + cp $source/entries/.version $dest/ + cp $source/entries/* $dest/ + fi +done + +rm -rf $source/entries Index: konqueror/sidebar/sidebar_widget.cpp =================================================================== RCS file: /home/kde/kdebase/konqueror/sidebar/sidebar_widget.cpp,v retrieving revision 1.134 diff -u -p -r1.134 sidebar_widget.cpp --- konqueror/sidebar/sidebar_widget.cpp 21 Sep 2004 16:32:35 -0000 1.134 +++ konqueror/sidebar/sidebar_widget.cpp 28 Oct 2004 01:56:22 -0000 @@ -51,11 +51,12 @@ bool Sidebar_Widget::s_skipInitialCopy=false; -addBackEnd::addBackEnd(QWidget *parent,class QPopupMenu *addmenu,bool universal, const char *name) +addBackEnd::addBackEnd(QWidget *parent,class QPopupMenu *addmenu,bool universal,const QString ¤tProfile, const char *name) : QObject(parent,name), m_parent(parent) { m_universal=universal; + m_currentProfile = currentProfile; menu = addmenu; connect(menu,SIGNAL(aboutToShow()),this,SLOT(aboutToShowAddMenu())); connect(menu,SIGNAL(activated(int)),this,SLOT(activatedAddMenu(int))); @@ -121,7 +122,7 @@ void addBackEnd::doRollBack() if (KMessageBox::questionYesNo(m_parent, i18n("This removes all your entries from the sidebar and adds the system default ones.
This procedure is irreversible
Do you want to proceed?
"))==KMessageBox::Yes) { KStandardDirs *dirs = KGlobal::dirs(); - QString loc=dirs->saveLocation("data","konqsidebartng/",true); + QString loc=dirs->saveLocation("data","konqsidebartng/" + m_currentProfile + "/",true); QDir dir(loc); QStringList dirEntries = dir.entryList( QDir::Dirs | QDir::NoSymLinks ); dirEntries.remove("."); @@ -135,7 +136,7 @@ void addBackEnd::doRollBack() } -static QString findFileName(const QString* tmpl,bool universal) { +static QString findFileName(const QString* tmpl,bool universal, const QString &profile) { QString myFile, filename; KStandardDirs *dirs = KGlobal::dirs(); QString tmp = *tmpl; @@ -144,8 +145,8 @@ static QString findFileName(const QStrin dirs->saveLocation("data", "konqsidebartng/kicker_entries/", true); tmp.prepend("/konqsidebartng/kicker_entries/"); } else { - dirs->saveLocation("data", "konqsidebartng/entries/", true); - tmp.prepend("/konqsidebartng/entries/"); + dirs->saveLocation("data", "konqsidebartng/" + profile + "/entries/", true); + tmp.prepend("/konqsidebartng/" + profile + "/entries/"); } filename = tmp.arg(""); myFile = locateLocal("data", filename); @@ -194,7 +195,7 @@ void addBackEnd::activatedAddMenu(int id QString *tmp = new QString(""); if (func(tmp,libParam.at(id),&map)) { - QString myFile = findFileName(tmp,m_universal); + QString myFile = findFileName(tmp,m_universal,m_currentProfile); if (!myFile.isEmpty()) { @@ -227,8 +228,8 @@ void addBackEnd::activatedAddMenu(int id /* Sidebar_Widget */ /**************************************************************/ -Sidebar_Widget::Sidebar_Widget(QWidget *parent, KParts::ReadOnlyPart *par, const char *name,bool universalMode) - :QWidget(parent,name),m_universalMode(universalMode),m_partParent(par) +Sidebar_Widget::Sidebar_Widget(QWidget *parent, KParts::ReadOnlyPart *par, const char *name,bool universalMode, const QString ¤tProfile) + :QWidget(parent,name),m_universalMode(universalMode),m_partParent(par),m_currentProfile(currentProfile) { m_somethingVisible = false; m_initial = true; @@ -239,9 +240,14 @@ Sidebar_Widget::Sidebar_Widget(QWidget * m_userMovedSplitter = false; //kdDebug() << "**** Sidebar_Widget:SidebarWidget()"<saveLocation("data", "konqsidebartng/kicker_entries/", true); + { + m_relPath = "konqsidebartng/kicker_entries/"; + } else - m_path = KGlobal::dirs()->saveLocation("data", "konqsidebartng/entries/", true); + { + m_relPath = "konqsidebartng/" + currentProfile + "/entries/"; + } + m_path = KGlobal::dirs()->saveLocation("data", m_relPath, true); m_buttons.setAutoDelete(true); m_hasStoredUrl = false; m_latestViewed = -1; @@ -284,7 +290,7 @@ Sidebar_Widget::Sidebar_Widget(QWidget * this, SLOT(activatedMenu(int))); m_buttonPopup = 0; - addBackEnd *ab = new addBackEnd(this, addMenu,universalMode,"Sidebar_Widget-addBackEnd"); + addBackEnd *ab = new addBackEnd(this, addMenu,universalMode,currentProfile,"Sidebar_Widget-addBackEnd"); connect(ab, SIGNAL(updateNeeded()), this, SLOT(updateButtons())); connect(ab, SIGNAL(initialCopyNeeded()), @@ -297,9 +303,12 @@ Sidebar_Widget::Sidebar_Widget(QWidget * s_skipInitialCopy=true; if (universalMode) - m_config = new KConfig("konqsidebartng_kicker.rc"); + m_config = new KConfig("konqsidebartng_kicker.rc"); else - m_config = new KConfig("konqsidebartng.rc"); + { + m_config = new KConfig("konqsidebartng.rc"); + m_config->setGroup(currentProfile); + } connect(&m_configTimer, SIGNAL(timeout()), this, SLOT(saveConfig())); readConfig(); @@ -317,13 +326,8 @@ void Sidebar_Widget::addWebSideBar(const // Look for existing ones with this URL KStandardDirs *dirs = KGlobal::dirs(); QString list; - if (m_universalMode) { - dirs->saveLocation("data", "konqsidebartng/kicker_entries/", true); - list = locateLocal("data", "/konqsidebartng/kicker_entries/"); - } else { - dirs->saveLocation("data", "konqsidebartng/entries/", true); - list = locateLocal("data", "/konqsidebartng/entries/"); - } + dirs->saveLocation("data", m_relPath, true); + list = locateLocal("data", m_relPath); // Go through list to see which ones exist. Check them for the URL QStringList files = QDir(list).entryList("websidebarplugin*.desktop"); @@ -339,7 +343,7 @@ void Sidebar_Widget::addWebSideBar(const } QString tmpl = "websidebarplugin%1.desktop"; - QString myFile = findFileName(&tmpl,m_universalMode); + QString myFile = findFileName(&tmpl,m_universalMode,m_currentProfile); if (!myFile.isEmpty()) { KSimpleConfig scf(myFile, false); @@ -359,10 +363,7 @@ void Sidebar_Widget::addWebSideBar(const void Sidebar_Widget::finishRollBack() { - if (m_universalMode) - m_path = KGlobal::dirs()->saveLocation("data","konqsidebartng/kicker_entries/",true); - else - m_path = KGlobal::dirs()->saveLocation("data","konqsidebartng/entries/",true); + m_path = KGlobal::dirs()->saveLocation("data",m_relPath,true); initialCopy(); QTimer::singleShot(0,this,SLOT(updateButtons())); } @@ -1240,16 +1241,7 @@ void Sidebar_Widget::customEvent(QCustom } else { emit fileMouseOver(*static_cast(ev)->item()); } - } else if (KonqConfigEvent::test(ev)) { - KonqConfigEvent *event = static_cast(ev); - if (event->save()) - event->config()->writeEntry(event->prefix()+"OpenViews",m_visibleViews); - else - { - if (event->config()->hasKey(event->prefix()+"OpenViews")) - m_openViews = event->config()->readListEntry(event->prefix()+"OpenViews"); - } - } + } } void Sidebar_Widget::resizeEvent(QResizeEvent* ev) Index: konqueror/sidebar/sidebar_widget.h =================================================================== RCS file: /home/kde/kdebase/konqueror/sidebar/sidebar_widget.h,v retrieving revision 1.55 diff -u -p -r1.55 sidebar_widget.h --- konqueror/sidebar/sidebar_widget.h 11 Jun 2004 17:55:06 -0000 1.55 +++ konqueror/sidebar/sidebar_widget.h 28 Oct 2004 01:56:22 -0000 @@ -74,7 +74,7 @@ class addBackEnd: public QObject { Q_OBJECT public: - addBackEnd(QWidget *parent,class QPopupMenu *addmenu, bool univeral,const char *name=0); + addBackEnd(QWidget *parent,class QPopupMenu *addmenu, bool univeral, const QString ¤tProfile, const char *name=0); ~addBackEnd(){;} protected slots: void aboutToShowAddMenu(); @@ -87,6 +87,7 @@ private: QPtrVector libNames; QPtrVector libParam; bool m_universal; + QString m_currentProfile; void doRollBack(); QWidget *m_parent; }; @@ -98,7 +99,8 @@ public: friend class ButtonInfo; public: Sidebar_Widget(QWidget *parent, KParts::ReadOnlyPart *par, - const char * name,bool universalMode); + const char * name,bool universalMode, + const QString ¤tProfile); ~Sidebar_Widget(); bool openURL(const class KURL &url); void stdAction(const char *handlestd); @@ -205,6 +207,8 @@ private: bool m_initial; QString m_path; + QString m_relPath; + QString m_currentProfile; QStringList m_visibleViews; // The views that are actually open QStringList m_openViews; // The views that should be opened --0-1306925287-1098932661=:12759 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --0-1306925287-1098932661=:12759--