[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.3/kdebase/apps/konqueror/src
From: David Faure <faure () kde ! org>
Date: 2009-10-16 11:50:29
Message-ID: 1255693829.869486.7311.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1036044 by dfaure:
Fix "Adding tab (Ctrl+T) in detached (tab) window crashes Konqueror".
Excellent investigation, unit-test, and suggested fixes by Frank Reininghaus. BUG \
203069.
M +11 -2 konqviewmanager.cpp
M +3 -2 konqviewmanager.h
M +60 -0 tests/konqviewmgrtest.cpp
M +2 -0 tests/konqviewmgrtest.h
--- branches/KDE/4.3/kdebase/apps/konqueror/src/konqviewmanager.cpp #1036043:1036044
@@ -295,7 +295,7 @@
#endif
}
-void KonqViewManager::breakOffTab( KonqFrameBase* currentFrame, const QSize& \
windowSize ) +KonqMainWindow* KonqViewManager::breakOffTab( KonqFrameBase* \
currentFrame, const QSize& windowSize ) {
#ifdef DEBUG_VIEWMGR
kDebug(1202) << currentFrame;
@@ -316,7 +316,9 @@
KonqMainWindow *mainWindow = new KonqMainWindow(KUrl(), m_pMainWindow->xmlFile());
- mainWindow->viewManager()->loadRootItem( profileGroup, \
mainWindow->viewManager()->tabContainer(), KUrl(), true, KUrl() ); + KonqFrameTabs* \
newTabContainer = mainWindow->viewManager()->tabContainer(); + \
mainWindow->viewManager()->loadRootItem( profileGroup, newTabContainer, KUrl(), true, \
KUrl() ); + mainWindow->viewManager()->setCurrentProfile( currentProfile() );
removeTab( currentFrame, false );
@@ -329,6 +331,8 @@
m_pMainWindow->dumpViewList();
printFullHierarchy();
#endif
+
+ return mainWindow;
}
void KonqViewManager::openClosedWindow(const KonqClosedWindowItem& closedWindowItem)
@@ -1187,6 +1191,11 @@
childView->frame()->show();
+ if (parent == m_tabContainer && m_tabContainer->count() == 1) {
+ // First tab, make it the active one
+ parent->setActiveChild(childView->frame());
+ }
+
if (openUrl) {
const QString keyHistoryItems = QString::fromLatin1( \
"NumberOfHistoryItems" ).prepend( prefix ); if( cfg.hasKey(keyHistoryItems) ) {
--- branches/KDE/4.3/kdebase/apps/konqueror/src/konqviewmanager.h #1036043:1036044
@@ -109,9 +109,10 @@
/**
* Break the current tab off into a new window,
- * if none is specified, the current one is used
+ * if none is specified, the current one is used.
+ * Returns the newly created window.
*/
- void breakOffTab( KonqFrameBase* tab, const QSize& windowSize );
+ KonqMainWindow* breakOffTab( KonqFrameBase* tab, const QSize& windowSize );
/**
* Guess!:-)
--- branches/KDE/4.3/kdebase/apps/konqueror/src/tests/konqviewmgrtest.cpp \
#1036043:1036044 @@ -234,13 +234,18 @@
// Split again
+ int widthFrame2 = frame2->width();
KonqView* view3 = viewManager->splitView( view, Qt::Horizontal );
QVERIFY( view3 );
QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[C(C(FF)F)].") );
+ // Check that the width of the second frame has not changed (bug 160407)
+ QCOMPARE( frame2->width(), widthFrame2 );
// Now test removing the first view
viewManager->removeView( view );
QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[C(FF)].") ); // \
mainWindow, tab widget, one splitter, two frames + // Check again that the width \
of the second frame has not changed (bug 160407 comments 18-20) + QCOMPARE( \
frame2->width(), widthFrame2 );
// Now test removing the last view
viewManager->removeView( view3 );
@@ -623,4 +628,59 @@
// QCOMPARE(view->url(), KUrl("data:text/html, <p>Second tab test</p>"));
}
+void ViewMgrTest::testBreakOffTab()
+{
+ KonqMainWindow mainWindow;
+ KonqViewManager* viewManager = mainWindow.viewManager();
+ KonqView* view = viewManager->createFirstView( "KonqAboutPage", "konq_aboutpage" \
); +
+ KonqFrameBase* tab = view->frame();
+ viewManager->duplicateTab( tab );
+ QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[FF].") ); // \
mainWindow, tab widget, two tabs +
+ // Break off a tab
+
+ KonqMainWindow* mainWindow2 = viewManager->breakOffTab( tab, mainWindow.size() \
); + QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[F].") ); // \
mainWindow, one tab, one frame + QCOMPARE( \
DebugFrameVisitor::inspect(mainWindow2), QString("MT[F].") ); // mainWindow, one tab, \
one frame +
+ // Verify that the new tab container has an active child and that duplicating \
the tab in the new window does not crash (bug 203069) +
+ QVERIFY( mainWindow2->viewManager()->tabContainer()->activeChild() );
+ mainWindow2->viewManager()->duplicateTab( \
mainWindow2->activeChildView()->frame() ); + QCOMPARE( \
DebugFrameVisitor::inspect(mainWindow2), QString("MT[FF].") ); // mainWindow, tab \
widget, two tabs +
+ delete mainWindow2;
+
+ // Now split the remaining view, duplicate the tab and verify that breaking off \
a split tab does not crash (bug 174292). + // Also check that the tab container of \
the new main window has an active child. +
+ view = mainWindow.activeChildView();
+ viewManager->splitView( view, Qt::Vertical );
+ QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[C(FF)].") ); // \
mainWindow, tab widget, one splitter, two frames + KonqFrameContainerBase* \
container = view->frame()->parentContainer(); + viewManager->duplicateTab( \
container ); + QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), \
QString("MT[C(FF)C(FF)].") ); // mainWindow, tab widget, two tabs with split views + \
mainWindow2 = viewManager->breakOffTab( container, mainWindow.size() ); + \
QCOMPARE( DebugFrameVisitor::inspect(&mainWindow), QString("MT[C(FF)].") ); // \
mainWindow, tab widget, one splitter, two frames + QCOMPARE( \
DebugFrameVisitor::inspect(mainWindow2), QString("MT[C(FF)].") ); // mainWindow, tab \
widget, one splitter, two frames + QVERIFY( \
mainWindow2->viewManager()->tabContainer()->activeChild() ); +
+ delete mainWindow2;
+
+ // Verify that breaking off a tab preserves the view profile (bug 210686)
+
+ const QString profile = KStandardDirs::locate("data", \
"konqueror/profiles/webbrowsing"); + QVERIFY(!profile.isEmpty());
+ const QString path = QDir::homePath();
+ mainWindow.viewManager()->loadViewProfileFromFile(profile, "webbrowsing");
+ view = mainWindow.activeChildView();
+ tab = view->frame();
+ viewManager->duplicateTab( tab );
+ mainWindow2 = viewManager->breakOffTab( tab, mainWindow.size() );
+ QCOMPARE( viewManager->currentProfile(), \
mainWindow2->viewManager()->currentProfile() ); +
+ delete mainWindow2;
+}
+
#include "konqviewmgrtest.moc"
--- branches/KDE/4.3/kdebase/apps/konqueror/src/tests/konqviewmgrtest.h \
#1036043:1036044 @@ -55,6 +55,8 @@
void testBrowserArgumentsNewTab();
+ void testBreakOffTab();
+
static void sendAllPendingResizeEvents(QWidget*);
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic