Commit d29b550f authored by David Faure's avatar David Faure
Browse files

Fix a number of QString vs KUrl confusions which made "konqueror $HOME" abort on startup

(due to the KUrl assert to detect such mixups).

svn path=/trunk/KDE/kdebase/konqueror/; revision=531485
parent d258ab76
......@@ -49,14 +49,14 @@ const int KonqCombo::temporary = 0;
#warning "This needs massive porting, mostly stubbed out"
#endif
static QString titleOfURL( const KUrl& url )
static QString titleOfURL( const QString& urlStr )
{
KonqHistoryList historylist = KonqHistoryManager::kself()->entries();
KUrl url = KUrl::fromPathOrURL( urlStr );
const KonqHistoryList& historylist = KonqHistoryManager::kself()->entries();
KonqHistoryEntry *historyentry = historylist.findEntry( url );
if ( !historyentry && !url.url().endsWith( "/" ) ) {
KUrl _url = url;
_url.setPath( url.path()+'/' );
historyentry = historylist.findEntry( _url );
url.setPath( url.path()+'/' );
historyentry = historylist.findEntry( url );
}
return ( historyentry ? historyentry->title : QString() );
}
......@@ -238,8 +238,7 @@ void KonqCombo::applyPermanent()
removeItem( --index );
QString item = temporaryItem();
KUrl url = KUrl::fromPathOrURL( item );
insertItem( KonqPixmapProvider::self()->pixmapFor( item ), item, 1, titleOfURL( url ) );
insertItem( KonqPixmapProvider::self()->pixmapFor( item ), item, 1, titleOfURL( item ) );
//kDebug(1202) << "KonqCombo::applyPermanent: " << url << endl;
// Remove all duplicates starting from index = 2
......@@ -336,14 +335,13 @@ void KonqCombo::loadItems()
while ( it != items.end() ) {
item = *it;
if ( !item.isEmpty() ) { // only insert non-empty items
KUrl url = KUrl::fromPathOrURL( item );
if( first ) {
insertItem( KonqPixmapProvider::self()->pixmapFor( item, K3Icon::SizeSmall ),
item, i++, titleOfURL( url ) );
item, i++, titleOfURL( item ) );
}
else
// icons will be loaded on-demand
insertItem( item, i++, titleOfURL( url ) );
insertItem( item, i++, titleOfURL( item ) );
first = false;
}
++it;
......@@ -584,7 +582,7 @@ void KonqCombo::mouseMoveEvent( QMouseEvent *e )
(e->pos() - m_dragStart).manhattanLength() >
KGlobalSettings::dndEventDelay() )
{
KUrl url ( currentText() );
KUrl url = KUrl::fromPathOrURL( currentText() );
if ( url.isValid() )
{
QDrag* drag = new QDrag(this);
......
......@@ -433,7 +433,7 @@ void KonqFrame::setTitle( const QString &title , QWidget* /*sender*/)
if (m_pParentContainer) m_pParentContainer->setTitle( title , this);
}
void KonqFrame::setTabIcon( const QString &url, QWidget* /*sender*/ )
void KonqFrame::setTabIcon( const KUrl &url, QWidget* /*sender*/ )
{
//kDebug(1202) << "KonqFrame::setTabIcon( " << url << " )" << endl;
if (m_pParentContainer) m_pParentContainer->setTabIcon( url, this );
......@@ -613,13 +613,15 @@ void KonqFrameContainer::swapChildren()
void KonqFrameContainer::setTitle( const QString &title , QWidget* sender)
{
//kDebug(1202) << "KonqFrameContainer::setTitle( " << title << " , " << sender << " )" << endl;
if (m_pParentContainer && activeChild() && (sender == activeChild()->widget())) m_pParentContainer->setTitle( title , this);
if (m_pParentContainer && activeChild() && (sender == activeChild()->widget()))
m_pParentContainer->setTitle( title , this);
}
void KonqFrameContainer::setTabIcon( const QString &url, QWidget* sender )
void KonqFrameContainer::setTabIcon( const KUrl &url, QWidget* sender )
{
//kDebug(1202) << "KonqFrameContainer::setTabIcon( " << url << " , " << sender << " )" << endl;
if (m_pParentContainer && activeChild() && (sender == activeChild()->widget())) m_pParentContainer->setTabIcon( url, this );
if (m_pParentContainer && activeChild() && (sender == activeChild()->widget()))
m_pParentContainer->setTabIcon( url, this );
}
void KonqFrameContainer::insertChildFrame( KonqFrameBase* frame, int /*index*/ )
......
......@@ -177,7 +177,7 @@ class KonqFrameBase
virtual void setParentContainer(KonqFrameContainerBase* parent) { m_pParentContainer = parent; }
virtual void setTitle( const QString &title , QWidget* sender) = 0;
virtual void setTabIcon( const QString &url, QWidget* sender ) = 0;
virtual void setTabIcon( const KUrl &url, QWidget* sender ) = 0;
virtual QWidget* widget() = 0;
......@@ -258,7 +258,7 @@ public:
virtual void printFrameInfo( const QString& spaces );
virtual void setTitle( const QString &title, QWidget* sender );
virtual void setTabIcon( const QString &url, QWidget* sender );
virtual void setTabIcon( const KUrl &url, QWidget* sender );
virtual void reparentFrame(QWidget * parent,
const QPoint & p, bool showIt=false );
......@@ -379,7 +379,7 @@ public:
void swapChildren();
virtual void setTitle( const QString &title, QWidget* sender );
virtual void setTabIcon( const QString &url, QWidget* sender );
virtual void setTabIcon( const KUrl &url, QWidget* sender );
virtual QWidget* widget() { return this; }
virtual QByteArray frameType() { return QByteArray("Container"); }
......@@ -408,7 +408,7 @@ public:
Q_SIGNALS:
void ctrlTabPressed();
void setRubberbandCalled();
protected:
KonqFrameBase* m_pFirstChild;
KonqFrameBase* m_pSecondChild;
......
......@@ -5486,7 +5486,7 @@ KonqFrameContainerBase* KonqMainWindow::parentContainer()const { return 0L; }
void KonqMainWindow::setParentContainer(KonqFrameContainerBase* /*parent*/) { return; }
void KonqMainWindow::setTitle( const QString &/*title*/ , QWidget* /*sender*/) { return; }
void KonqMainWindow::setTabIcon( const QString &/*url*/, QWidget* /*sender*/ ) { return; }
void KonqMainWindow::setTabIcon( const KUrl &/*url*/, QWidget* /*sender*/ ) { return; }
QWidget* KonqMainWindow::widget() { return this; }
......
......@@ -295,7 +295,7 @@ public:
void setParentContainer(KonqFrameContainerBase* parent);
void setTitle( const QString &title , QWidget* sender);
void setTabIcon( const QString &url, QWidget* sender );
void setTabIcon( const KUrl &url, QWidget* sender );
QWidget* widget();
......
......@@ -255,7 +255,7 @@ void KonqFrameTabs::setTitle( const QString &title , QWidget* sender)
setTabText( indexOf( sender ), title );
}
void KonqFrameTabs::setTabIcon( const QString &url, QWidget* sender )
void KonqFrameTabs::setTabIcon( const KUrl &url, QWidget* sender )
{
//kDebug(1202) << "KonqFrameTabs::setTabIcon( " << url << " , " << sender << " )" << endl;
QIcon iconSet;
......@@ -293,7 +293,7 @@ void KonqFrameTabs::insertChildFrame( KonqFrameBase* frame, int index )
KonqView* activeChildView = frame->activeChildView();
if (activeChildView != 0L) {
activeChildView->setCaption( activeChildView->caption() );
activeChildView->setTabIcon( activeChildView->url().url() );
activeChildView->setTabIcon( activeChildView->url() );
}
if (showTabBar)
setTabBarHidden(false);
......
......@@ -66,7 +66,7 @@ public:
QList<KonqFrameBase*>* childFrameList() { return m_pChildFrameList; }
virtual void setTitle( const QString &title, QWidget* sender );
virtual void setTabIcon( const QString &url, QWidget* sender );
virtual void setTabIcon( const KUrl &url, QWidget* sender );
virtual QWidget* widget() { return this; }
virtual QByteArray frameType() { return QByteArray("Tabs"); }
......
......@@ -645,7 +645,7 @@ void KonqView::setLocationBarURL( const QString & locationBarURL )
m_pMainWindow->setLocationBarURL( m_sLocationBarURL );
m_pMainWindow->setPageSecurity( m_pageSecurity );
}
if (!m_bPassiveMode) setTabIcon( m_sLocationBarURL );
if (!m_bPassiveMode) setTabIcon( KUrl::fromPathOrURL( m_sLocationBarURL ) );
}
void KonqView::setIconURL( const KUrl & iconURL )
......@@ -668,7 +668,7 @@ void KonqView::setPageSecurity( int pageSecurity )
m_pMainWindow->setPageSecurity( m_pageSecurity );
}
void KonqView::setTabIcon( const QString &url )
void KonqView::setTabIcon( const KUrl &url )
{
if (!m_bPassiveMode) frame()->setTabIcon( url, 0L );
}
......@@ -682,7 +682,7 @@ void KonqView::setCaption( const QString & caption )
if (url().isLocalFile())
{
// Is the caption a URL? If so, is it local? If so, only display the filename!
KUrl url(caption);
KUrl url = KUrl::fromPathOrURL(caption);
if (url.isValid() && url.isLocalFile() && url.fileName() == this->url().fileName())
adjustedCaption = url.fileName();
}
......
......@@ -358,7 +358,7 @@ public Q_SLOTS:
*/
void setIconURL( const KUrl &iconURL );
void setTabIcon( const QString &url );
void setTabIcon( const KUrl &url );
void setCaption( const QString & caption );
......
......@@ -719,7 +719,7 @@ void KonqViewManager::updatePixmaps()
tabContainer->listViews( &viewList );
foreach ( KonqView* view, viewList )
view->setTabIcon( view->locationBarURL() );
view->setTabIcon( KUrl::fromPathOrURL( view->locationBarURL() ) );
}
void KonqViewManager::removeView( KonqView *view )
......@@ -1619,7 +1619,7 @@ void KonqViewManager::loadItem( KConfig &cfg, KonqFrameContainerBase *parent,
KonqView* activeChildView = dynamic_cast<KonqFrameBase*>(currentPage)->activeChildView();
if (activeChildView != 0L) {
activeChildView->setCaption( activeChildView->caption() );
activeChildView->setTabIcon( activeChildView->url().url() );
activeChildView->setTabIcon( activeChildView->url() );
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment