[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [PATCH] Konqueor Home URL
From: Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date: 2007-12-27 16:33:18
Message-ID: 200712271733.18839.bbeschow () cs ! tu-berlin ! de
[Download RAW message or body]
Hi list,
I really like Konqueor. However, what has been annoying to me so far was the
fact that the home url always pointed to the home folder, even in web mode.
The current code already tries to retrieve the home url from the view
profiles but there has been no entry there yet. This patch solves this issue
by really storing the home url into the view profiles. This is also
configurable through the updated KonqProfileDlg.
Now there is a question: This patch would either introduce a new string after
the string freeze, which is bad. To avoid this, I reused the string ("Home
&URL") from the old url requester in this patch. This, however, leads to a
conflicting shortcut of the string "Save &URLs in profile". KDE seems to
handle this by giving "Save &URLs in profile" the shortcut but not to "Home
&URL". See screenshot: [http://www.250kb.de/u/071227/p/6b9010f3.png]
What do you think?
Best whishes,
Bernhard
["homeURL.diff" (text/x-diff)]
Index: profile_webbrowsing.desktop
===================================================================
--- profile_webbrowsing.desktop (Revision 753483)
+++ profile_webbrowsing.desktop (Arbeitskopie)
@@ -68,6 +68,7 @@
Name[zh_CN]=Web 浏览
Name[zh_TW]=網 瀏覽
XMLUIFile=konq-webbrowsing.rc
+HomeURL=about:konqueror
RootItem=View0
View0_ServiceName=konq_aboutpage
View0_ServiceType=KonqAboutPage
Index: profile_simplebrowser.desktop
===================================================================
--- profile_simplebrowser.desktop (Revision 753483)
+++ profile_simplebrowser.desktop (Arbeitskopie)
@@ -64,6 +64,7 @@
Name[zh_CN]=简单浏览器
Name[zh_TW]=簡易瀏覽器
XMLUIFile=konq-simplebrowser.rc
+HomeURL=about:konqueror
RootItem=View0
View0_ServiceName=konq_aboutpage
View0_ServiceType=KonqAboutPage
Index: src/konqviewmanager.cpp
===================================================================
--- src/konqviewmanager.cpp (Revision 753483)
+++ src/konqviewmanager.cpp (Arbeitskopie)
@@ -37,6 +37,7 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <ktoolbarpopupaction.h>
+#include <kurl.h>
#include <kmenu.h>
@@ -770,7 +771,7 @@
///////////////// Profile stuff ////////////////
-void KonqViewManager::saveViewProfileToFile( const QString & fileName, const QString \
& profileName, bool saveURLs, bool saveWindowSize ) +void \
KonqViewManager::saveViewProfileToFile( const QString & fileName, const QString & \
profileName, const KUrl &homeURL, bool saveURLs, bool saveWindowSize ) {
QString path = KStandardDirs::locateLocal( "data", QString::fromLatin1( \
"konqueror/profiles/" ) + @@ -784,6 +785,7 @@
if ( !profileName.isEmpty() )
cfg.writePathEntry( "Name", profileName );
+ cfg.writePathEntry( "HomeURL", homeURL.prettyUrl() );
KonqFrameBase::Options options = KonqFrameBase::None;
if(saveURLs)
options = KonqFrameBase::saveURLs;
Index: src/konqprofiledlg_base.ui
===================================================================
--- src/konqprofiledlg_base.ui (Revision 0)
+++ src/konqprofiledlg_base.ui (Revision 0)
@@ -0,0 +1,77 @@
+<ui version="4.0" >
+ <class>KonqProfileDlgBase</class>
+ <widget class="QWidget" name="KonqProfileDlgBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="lblName" >
+ <property name="text" >
+ <string>&Profile name:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>m_pProfileNameLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="KLineEdit" name="m_pProfileNameLineEdit" />
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="KListWidget" name="m_pListView" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="lblHomeURL" >
+ <property name="text" >
+ <string>Home &URL:</string>
+ </property>
+ <property name="buddy" >
+ <cstring>m_pHomeURLRequester</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="KUrlRequester" name="m_pHomeURLRequester" />
+ </item>
+ <item row="4" column="0" colspan="2" >
+ <widget class="QCheckBox" name="m_cbSaveURLs" >
+ <property name="text" >
+ <string>Save &URLs in profile</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <widget class="QCheckBox" name="m_cbSaveSize" >
+ <property name="text" >
+ <string>Save &window size in profile</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KListWidget</class>
+ <extends>QListWidget</extends>
+ <header>klistwidget.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KUrlRequester</class>
+ <extends>QFrame</extends>
+ <header>kurlrequester.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Eigenschaftsänderungen: src/konqprofiledlg_base.ui
___________________________________________________________________
Name: svn:executable
+ *
Index: src/konqviewmanager.h
===================================================================
--- src/konqviewmanager.h (Revision 753483)
+++ src/konqviewmanager.h (Arbeitskopie)
@@ -45,6 +45,7 @@
class KonqView;
class KActionMenu;
class KonqClosedTabItem;
+class KUrl;
namespace KParts
{
@@ -178,7 +179,7 @@
* @param saveURLs whether to save the URLs in the profile
* @param saveWindowSize whether to save the size of the window in the profile
*/
- void saveViewProfileToFile( const QString & fileName, const QString & profileName,
+ void saveViewProfileToFile( const QString & fileName, const QString & profileName, \
const KUrl &homeURL, bool saveURLs, bool saveWindowSize );
/**
Index: src/konqmainwindow.cpp
===================================================================
--- src/konqmainwindow.cpp (Revision 753483)
+++ src/konqmainwindow.cpp (Arbeitskopie)
@@ -1305,7 +1302,7 @@
{
KTemporaryFile tempFile;
tempFile.open();
- m_pViewManager->saveViewProfileToFile( tempFile.fileName(), QString(), true, true \
); + m_pViewManager->saveViewProfileToFile( tempFile.fileName(), QString(), KUrl(), \
true, true );
KonqMainWindow *mainWindow = new KonqMainWindow( KUrl(), xmlFile() );
mainWindow->viewManager()->loadViewProfileFromFile( tempFile.fileName(), \
m_pViewManager->currentProfile() );
Index: src/konqprofiledlg.cpp
===================================================================
--- src/konqprofiledlg.cpp (Revision 753483)
+++ src/konqprofiledlg.cpp (Arbeitskopie)
@@ -20,12 +20,14 @@
#include "konqprofiledlg.h"
#include "konqviewmanager.h"
#include "konqsettingsxt.h"
+#include "ui_konqprofiledlg_base.h"
#include <QtGui/QCheckBox>
#include <QtCore/QDir>
#include <kvbox.h>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
+#include <QtGui/QListWidgetItem>
#include <kdebug.h>
#include <kstandardguiitem.h>
@@ -37,6 +39,16 @@
#include <klistwidget.h>
#include <kpushbutton.h>
+class KonqProfileDlg::KonqProfileItem : public QListWidgetItem
+{
+public:
+ KonqProfileItem( KListWidget *, const QString & );
+ ~KonqProfileItem() {}
+
+ QString m_profileName;
+};
+
+
KonqProfileMap KonqProfileDlg::readAllProfiles()
{
KonqProfileMap mapProfiles;
@@ -62,7 +74,7 @@
return mapProfiles;
}
-KonqProfileItem::KonqProfileItem( KListWidget *parent, const QString & text )
+KonqProfileDlg::KonqProfileItem::KonqProfileItem( KListWidget *parent, const QString \
& text ) : QListWidgetItem( text, parent ), m_profileName( text )
{
setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
@@ -74,7 +86,14 @@
KonqProfileDlg::KonqProfileDlg( KonqViewManager *manager, const QString & \
preselectProfile, QWidget *parent ) : KDialog( parent )
+, m_pUi( new Ui_KonqProfileDlgBase() )
+, m_pViewManager( manager )
{
+ QWidget *contentWidget = new QWidget( this );
+ m_pUi->setupUi( contentWidget );
+ contentWidget->layout()->setMargin( 0 );
+ setMainWidget( contentWidget );
+
setObjectName( "konq_profile_dialog" );
setModal( true );
setCaption( i18n( "Profile Management" ) );
@@ -85,45 +104,26 @@
setButtonGuiItem( BTN_DELETE, KGuiItem( i18n( "&Delete Profile" ), "edit-delete" ) \
); setButtonGuiItem( BTN_SAVE, KStandardGuiItem::save() );
- m_pViewManager = manager;
+ m_pUi->m_pProfileNameLineEdit->setFocus();
- KVBox* box = new KVBox( this );
- box->setSpacing( KDialog::spacingHint() );
- setMainWidget( box );
-
- QLabel *lblName = new QLabel( i18n( "&Profile name:" ), box );
-
- m_pProfileNameLineEdit = new QLineEdit( box );
- m_pProfileNameLineEdit->setFocus();
-
- lblName->setBuddy( m_pProfileNameLineEdit );
-
- m_pListView = new KListWidget( box );
- m_pListView->setSelectionBehavior(QAbstractItemView::SelectItems);
- m_pListView->setSelectionMode(QAbstractItemView::SingleSelection);
-
- box->setStretchFactor( m_pListView, 1 );
-
- connect( m_pListView, SIGNAL( itemChanged( QListWidgetItem * ) ),
+ connect( m_pUi->m_pListView, SIGNAL( itemChanged( QListWidgetItem * ) ),
SLOT( slotItemRenamed( QListWidgetItem * ) ) );
loadAllProfiles( preselectProfile );
- m_pListView->setMinimumSize( m_pListView->sizeHint() );
+ m_pUi->m_pListView->setMinimumSize( m_pUi->m_pListView->sizeHint() );
- m_cbSaveURLs = new QCheckBox( i18n("Save &URLs in profile"), box );
- m_cbSaveURLs->setChecked( KonqSettings::saveURLInProfile() );
+ m_pUi->m_pHomeURLRequester->setPath( m_pViewManager->profileHomeURL() );
+ m_pUi->m_cbSaveURLs->setChecked( KonqSettings::saveURLInProfile() );
+ m_pUi->m_cbSaveSize->setChecked( KonqSettings::saveWindowSizeInProfile() );
- m_cbSaveSize = new QCheckBox( i18n("Save &window size in profile"), box );
- m_cbSaveSize->setChecked( KonqSettings::saveWindowSizeInProfile() );
-
- connect( m_pListView, SIGNAL( itemSelectionChanged() ),
+ connect( m_pUi->m_pListView, SIGNAL( itemSelectionChanged() ),
this, SLOT( slotSelectionChanged() ) );
- connect( m_pProfileNameLineEdit, SIGNAL( textChanged( const QString & ) ),
+ connect( m_pUi->m_pProfileNameLineEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( slotTextChanged( const QString & ) ) );
- enableButton( BTN_RENAME, m_pListView->currentItem() != 0 );
- enableButton( BTN_DELETE, m_pListView->currentItem() != 0 );
+ enableButton( BTN_RENAME, m_pUi->m_pListView->currentItem() != 0 );
+ enableButton( BTN_DELETE, m_pUi->m_pListView->currentItem() != 0 );
connect( this,SIGNAL(user1Clicked()),SLOT(slotRenameProfile()));
connect( this,SIGNAL(user2Clicked()),SLOT(slotDeleteProfile()));
@@ -134,42 +134,42 @@
KonqProfileDlg::~KonqProfileDlg()
{
- KonqSettings::setSaveURLInProfile( m_cbSaveURLs->isChecked() );
- KonqSettings::setSaveWindowSizeInProfile( m_cbSaveSize->isChecked() );
+ KonqSettings::setSaveURLInProfile( m_pUi->m_cbSaveURLs->isChecked() );
+ KonqSettings::setSaveWindowSizeInProfile( m_pUi->m_cbSaveSize->isChecked() );
}
void KonqProfileDlg::loadAllProfiles(const QString & preselectProfile)
{
bool profileFound = false;
m_mapEntries.clear();
- m_pListView->clear();
+ m_pUi->m_pListView->clear();
m_mapEntries = readAllProfiles();
KonqProfileMap::ConstIterator eIt = m_mapEntries.begin();
KonqProfileMap::ConstIterator eEnd = m_mapEntries.end();
for (; eIt != eEnd; ++eIt )
{
- QListWidgetItem *item = new KonqProfileItem( m_pListView, eIt.key() );
+ QListWidgetItem *item = new KonqProfileItem( m_pUi->m_pListView, eIt.key() \
);
QString filename = eIt.value().mid( eIt.value().lastIndexOf( '/' ) + 1 );
kDebug(1202) << filename;
if ( filename == preselectProfile )
{
profileFound = true;
- m_pProfileNameLineEdit->setText( eIt.key() );
- m_pListView->setCurrentItem( item );
+ m_pUi->m_pProfileNameLineEdit->setText( eIt.key() );
+ m_pUi->m_pListView->setCurrentItem( item );
}
}
if (!profileFound)
- m_pProfileNameLineEdit->setText( preselectProfile);
+ m_pUi->m_pProfileNameLineEdit->setText( preselectProfile);
}
void KonqProfileDlg::slotSave()
{
- QString name = KIO::encodeFileName( m_pProfileNameLineEdit->text() ); // in case \
of '/' + QString name = KIO::encodeFileName( m_pUi->m_pProfileNameLineEdit->text() \
); // in case of '/'
// Reuse filename of existing item, if any
- if ( m_pListView->currentItem() )
+ if ( m_pUi->m_pListView->currentItem() )
{
- KonqProfileMap::Iterator it = m_mapEntries.find( \
m_pListView->currentItem()->text() ); + KonqProfileMap::Iterator it = \
m_mapEntries.find( m_pUi->m_pListView->currentItem()->text() ); if ( it != \
m_mapEntries.end() ) {
QFileInfo info( it.value() );
@@ -178,31 +178,31 @@
}
kDebug(1202) << "Saving as " << name;
- m_pViewManager->saveViewProfileToFile( name, m_pProfileNameLineEdit->text(),
- m_cbSaveURLs->isChecked(), m_cbSaveSize->isChecked() );
+ m_pViewManager->saveViewProfileToFile( name, \
m_pUi->m_pProfileNameLineEdit->text(), m_pUi->m_pHomeURLRequester->url(), + \
m_pUi->m_cbSaveURLs->isChecked(), m_pUi->m_cbSaveSize->isChecked() );
accept();
}
void KonqProfileDlg::slotDeleteProfile()
{
- if(!m_pListView->currentItem())
+ if(!m_pUi->m_pListView->currentItem())
return;
- KonqProfileMap::Iterator it = m_mapEntries.find( \
m_pListView->currentItem()->text() ); + KonqProfileMap::Iterator it = \
m_mapEntries.find( m_pUi->m_pListView->currentItem()->text() );
if ( it != m_mapEntries.end() && QFile::remove( it.value() ) )
loadAllProfiles();
- enableButton( BTN_RENAME, m_pListView->currentItem() != 0 );
- enableButton( BTN_DELETE, m_pListView->currentItem() != 0 );
+ enableButton( BTN_RENAME, m_pUi->m_pListView->currentItem() != 0 );
+ enableButton( BTN_DELETE, m_pUi->m_pListView->currentItem() != 0 );
}
void KonqProfileDlg::slotRenameProfile()
{
- QListWidgetItem *item = m_pListView->currentItem();
+ QListWidgetItem *item = m_pUi->m_pListView->currentItem();
if ( item )
- m_pListView->editItem( item );
+ m_pUi->m_pListView->editItem( item );
}
void KonqProfileDlg::slotItemRenamed( QListWidgetItem * item )
@@ -229,7 +229,7 @@
// Didn't find how to change a key...
m_mapEntries.remove( oldName );
m_mapEntries.insert( newName, fileName );
- m_pProfileNameLineEdit->setText( newName );
+ m_pUi->m_pProfileNameLineEdit->setText( newName );
profileItem->m_profileName = newName;
}
}
@@ -237,8 +237,8 @@
void KonqProfileDlg::slotSelectionChanged()
{
- if ( m_pListView->currentItem() )
- m_pProfileNameLineEdit->setText( m_pListView->currentItem()->text() );
+ if ( m_pUi->m_pListView->currentItem() )
+ m_pUi->m_pProfileNameLineEdit->setText( \
m_pUi->m_pListView->currentItem()->text() ); }
void KonqProfileDlg::slotTextChanged( const QString & text )
@@ -247,9 +247,9 @@
// If we type the name of a profile, select it in the list
- QList<QListWidgetItem*> items = m_pListView->findItems(text, \
Qt::MatchCaseSensitive); + QList<QListWidgetItem*> items = \
m_pUi->m_pListView->findItems(text, Qt::MatchCaseSensitive); QListWidgetItem * item \
= !items.isEmpty() ? items.first() : 0;
- m_pListView->setCurrentItem(item);
+ m_pUi->m_pListView->setCurrentItem(item);
bool itemSelected = item;
if ( itemSelected )
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (Revision 753483)
+++ src/CMakeLists.txt (Arbeitskopie)
@@ -65,6 +65,7 @@
konqclosedtabitem.cpp
)
kde4_add_kcfg_files(konqueror_KDEINIT_SRCS konqsettingsxt.kcfgc)
+kde4_add_ui_files(konqueror_KDEINIT_SRCS konqprofiledlg_base.ui)
qt4_add_dbus_interface(konqueror_KDEINIT_SRCS org.kde.Konqueror.Main.xml \
konqueror_interface) qt4_add_dbus_interface(konqueror_KDEINIT_SRCS \
${KDE4_DBUS_INTERFACES_DIR}/org.kde.kded.xml kded_interface)
Index: src/konqprofiledlg.h
===================================================================
--- src/konqprofiledlg.h (Revision 753483)
+++ src/konqprofiledlg.h (Arbeitskopie)
@@ -23,26 +23,13 @@
#include <kdialog.h>
#include <QtCore/QMap>
-#include <QtGui/QGridLayout>
-#include <QtGui/QListWidgetItem>
class KonqViewManager;
-class QGridLayout;
-class QCheckBox;
-class QLineEdit;
-class KListWidget;
+class QListWidgetItem;
+class Ui_KonqProfileDlgBase;
typedef QMap<QString, QString> KonqProfileMap;
-class KonqProfileItem : public QListWidgetItem
-{
-public:
- KonqProfileItem( KListWidget *, const QString & );
- ~KonqProfileItem() {}
-
- QString m_profileName;
-};
-
class KonqProfileDlg : public KDialog
{
Q_OBJECT
@@ -56,6 +43,8 @@
*/
static KonqProfileMap readAllProfiles();
+ class KonqProfileItem;
+
protected Q_SLOTS:
void slotRenameProfile();
void slotDeleteProfile();
@@ -66,17 +55,11 @@
void slotItemRenamed( QListWidgetItem * );
private:
+ Ui_KonqProfileDlgBase * const m_pUi;
void loadAllProfiles(const QString & = QString());
- KonqViewManager *m_pViewManager;
+ KonqViewManager * const m_pViewManager;
KonqProfileMap m_mapEntries;
-
- QLineEdit *m_pProfileNameLineEdit;
-
- QCheckBox *m_cbSaveURLs;
- QCheckBox *m_cbSaveSize;
-
- KListWidget *m_pListView;
};
#endif
Index: profile_filemanagement.desktop
===================================================================
--- profile_filemanagement.desktop (Revision 753483)
+++ profile_filemanagement.desktop (Arbeitskopie)
@@ -68,6 +68,7 @@
Name[zh_CN]=文件管理
Name[zh_TW]=檔案管理
XMLUIFile=konq-filemanagement.rc
+HomeURL=~
RootItem=Container0
Container0_Children=View1,Tabs1
Container0_Orientation=Horizontal
Index: profile_midnightcommander.desktop
===================================================================
--- profile_midnightcommander.desktop (Revision 753483)
+++ profile_midnightcommander.desktop (Arbeitskopie)
@@ -24,6 +24,7 @@
Name[x-test]=xxMidnight Commanderxx
Name[xh]=Umyaleli Waphakathi kobusuku
XMLUIFile=konq-filemanagement.rc
+HomeURL=~
RootItem=Container0
View2_LinkedView=true
View2_PassiveMode=false
Index: profile_tabbedbrowsing.desktop
===================================================================
--- profile_tabbedbrowsing.desktop (Revision 753483)
+++ profile_tabbedbrowsing.desktop (Arbeitskopie)
@@ -67,6 +67,7 @@
Name[zh_CN]= 签页浏览
Name[zh_TW]=分 瀏覽
XMLUIFile=konq-webbrowsing.rc
+HomeURL=about:konqueror
RootItem=Tabs0
Tabs0_Children=ViewT0,ViewT1,ViewT2,ViewT3
Tabs0_activeChildIndex=0
Index: profile_filepreview.desktop
===================================================================
--- profile_filepreview.desktop (Revision 753483)
+++ profile_filepreview.desktop (Arbeitskopie)
@@ -75,6 +75,7 @@
Name[zh_CN]=文件预览
Name[zh_TW]=檔案 覽
XMLUIFile=konq-filemanagement.rc
+HomeURL=~
RootItem=Container0
View1_LinkedView=true
View1_LockedLocation=false
Index: profile_kde_devel.desktop
===================================================================
--- profile_kde_devel.desktop (Revision 753483)
+++ profile_kde_devel.desktop (Arbeitskopie)
@@ -67,6 +67,7 @@
Name[zh_CN]=KDE 开发
Name[zh_TW]=KDE 程式開發
XMLUIFile=konq-webbrowsing.rc
+HomeURL=about:konqueror
RootItem=Tabs0
Tabs0_Children=ViewT0,ViewT1,ViewT2,ViewT3,ViewT4
Tabs0_activeChildIndex=0
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic