Commit ed7f76f3 authored by Pascal Létourneau's avatar Pascal Létourneau
Browse files

Q3PtrList -> QList

svn path=/trunk/KDE/kdebase/konqueror/; revision=512583
parent 2b4a6343
......@@ -188,24 +188,22 @@ void KonquerorIface::reparseConfiguration()
KGlobal::config()->reparseConfiguration();
KonqFMSettings::reparseConfiguration();
Q3PtrList<KonqMainWindow> *mainWindows = KonqMainWindow::mainWindowList();
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
if ( mainWindows )
{
Q3PtrListIterator<KonqMainWindow> it( *mainWindows );
for (; it.current(); ++it )
it.current()->reparseConfiguration();
foreach ( KonqMainWindow* window, *mainWindows )
window->reparseConfiguration();
}
}
void KonquerorIface::updateProfileList()
{
Q3PtrList<KonqMainWindow> *mainWindows = KonqMainWindow::mainWindowList();
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
if ( !mainWindows )
return;
Q3PtrListIterator<KonqMainWindow> it( *mainWindows );
for (; it.current(); ++it )
it.current()->viewManager()->profileListDirty( false );
foreach ( KonqMainWindow* window, *mainWindows )
window->viewManager()->profileListDirty( false );
}
QString KonquerorIface::crashLogFile()
......@@ -216,12 +214,11 @@ QString KonquerorIface::crashLogFile()
QList<DCOPRef> KonquerorIface::getWindows()
{
QList<DCOPRef> lst;
Q3PtrList<KonqMainWindow> *mainWindows = KonqMainWindow::mainWindowList();
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
if ( mainWindows )
{
Q3PtrListIterator<KonqMainWindow> it( *mainWindows );
for (; it.current(); ++it )
lst.append( DCOPRef( kapp->dcopClient()->appId(), it.current()->dcopObject()->objId() ) );
foreach ( KonqMainWindow* window, *mainWindows )
lst.append( DCOPRef( kapp->dcopClient()->appId(), window->dcopObject()->objId() ) );
}
return lst;
}
......@@ -249,7 +246,7 @@ bool KonquerorIface::processCanBeReused( int screen )
return false; // this instance run on different screen, and Qt apps can't migrate
if( KonqMainWindow::isPreloaded())
return false; // will be handled by preloading related code instead
Q3PtrList<KonqMainWindow>* windows = KonqMainWindow::mainWindowList();
QList<KonqMainWindow*>* windows = KonqMainWindow::mainWindowList();
if( windows == NULL )
return true;
QStringList allowed_parts = KonqSettings::safeParts();
......@@ -273,18 +270,14 @@ bool KonquerorIface::processCanBeReused( int screen )
}
if( all_parts_allowed )
return true;
for( Q3PtrListIterator<KonqMainWindow> it1( *windows );
it1 != NULL;
++it1 )
foreach ( KonqMainWindow* window, *windows )
{
kDebug(1202) << "processCanBeReused: count=" << (*it1)->viewCount() << endl;
const KonqMainWindow::MapViews& views = (*it1)->viewMap();
for( KonqMainWindow::MapViews::ConstIterator it2 = views.begin();
it2 != views.end();
++it2 )
kDebug(1202) << "processCanBeReused: count=" << window->viewCount() << endl;
const KonqMainWindow::MapViews& views = window->viewMap();
foreach ( KonqView* view, views )
{
kDebug(1202) << "processCanBeReused: part=" << (*it2)->service()->desktopEntryPath() << ", URL=" << (*it2)->url().prettyURL() << endl;
if( !allowed_parts.contains( (*it2)->service()->desktopEntryPath()))
kDebug(1202) << "processCanBeReused: part=" << view->service()->desktopEntryPath() << ", URL=" << view->url().prettyURL() << endl;
if( !allowed_parts.contains( view->service()->desktopEntryPath()))
return false;
}
}
......
......@@ -31,7 +31,7 @@
#include <QPixmap>
#include <QPaintEvent>
#include <QChildEvent>
#include <Q3PtrList>
#include <QList>
#include <QEvent>
#include <QHBoxLayout>
#include <QVBoxLayout>
......@@ -157,7 +157,7 @@ class KonqFrameStatusBar : public KStatusBar
};
typedef Q3PtrList<KonqView> ChildViewList;
typedef QList<KonqView*> ChildViewList;
class KonqFrameBase
{
......
......@@ -283,15 +283,14 @@ void ToggleViewGUIClient::slotToggleView( bool toggle )
}
else
{
Q3PtrList<KonqView> viewList;
QList<KonqView*> viewList;
m_mainWindow->listViews( &viewList );
Q3PtrListIterator<KonqView> it( viewList );
for (; it.current(); ++it )
if ( it.current()->service()->desktopEntryName() == serviceName )
foreach ( KonqView* view, viewList )
if ( view->service()->desktopEntryName() == serviceName )
// takes care of choosing the new active view, and also calls slotViewRemoved
viewManager->removeView( it.current() );
viewManager->removeView( view );
}
}
......
......@@ -72,7 +72,7 @@
#include <QKeyEvent>
#include <QEvent>
#include <Q3CString>
#include <Q3PtrList>
#include <QList>
#include <QCloseEvent>
#include <QPixmap>
......@@ -129,10 +129,10 @@
#include <kauthorized.h>
#include <ktoolinvocation.h>
template class Q3PtrList<QPixmap>;
template class Q3PtrList<KToggleAction>;
template class QList<QPixmap*>;
template class QList<KToggleAction*>;
Q3PtrList<KonqMainWindow> *KonqMainWindow::s_lstViews = 0;
QList<KonqMainWindow*> *KonqMainWindow::s_lstViews = 0;
KConfig * KonqMainWindow::s_comboConfig = 0;
KCompletion * KonqMainWindow::s_pCompletion = 0;
QFile * KonqMainWindow::s_crashlog_file = 0;
......@@ -159,7 +159,7 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, bool openInitialURL, con
setPreloadedFlag( false );
if ( !s_lstViews )
s_lstViews = new Q3PtrList<KonqMainWindow>;
s_lstViews = new QList<KonqMainWindow*>;
s_lstViews->append( this );
......@@ -307,7 +307,7 @@ KonqMainWindow::~KonqMainWindow()
if ( s_lstViews )
{
s_lstViews->removeRef( this );
s_lstViews->removeAll( this );
if ( s_lstViews->count() == 0 )
{
delete s_lstViews;
......@@ -1008,15 +1008,11 @@ bool KonqMainWindow::makeViewsFollow( const KUrl & url, const KParts::URLArgs &a
req.args = args;
// We can't iterate over the map here, and openURL for each, because the map can get modified
// (e.g. by part changes). Better copy the views into a list.
Q3PtrList<KonqView> listViews;
MapViews::ConstIterator it = m_mapViews.begin();
MapViews::ConstIterator end = m_mapViews.end();
for (; it != end; ++it )
listViews.append( it.value());
QList<KonqView*> listViews = m_mapViews.values();
QObject *senderFrame = lastFrame( senderView );
for ( KonqView * view = listViews.first() ; view ; view = listViews.next())
foreach ( KonqView * view, listViews )
{
bool followed = false;
// Views that should follow this URL as both views are linked
......@@ -2401,14 +2397,13 @@ KonqView * KonqMainWindow::findChildView( KParts::ReadOnlyPart *callingPart, con
if ( !s_lstViews )
return 0;
Q3PtrListIterator<KonqMainWindow> it( *s_lstViews );
for (; it.current(); ++it )
foreach ( KonqMainWindow* window, *s_lstViews )
{
KonqView *res = it.current()->childView( callingPart, name, hostExtension, part );
KonqView *res = window->childView( callingPart, name, hostExtension, part );
if ( res )
{
if ( mainWindow )
*mainWindow = it.current();
*mainWindow = window;
return res;
}
}
......@@ -3192,13 +3187,11 @@ void KonqMainWindow::slotCompletionModeChanged( KGlobalSettings::Completion m )
KonqSettings::writeConfig();
// tell the other windows too (only this instance currently)
KonqMainWindow *window = s_lstViews->first();
while ( window ) {
if ( window->m_combo ) {
foreach ( KonqMainWindow* window, *s_lstViews ) {
if ( window && window->m_combo ) {
window->m_combo->setCompletionMode( m );
window->m_pURLCompletion->setCompletionMode( m );
}
window = s_lstViews->next();
}
}
......@@ -3590,9 +3583,8 @@ void KonqMainWindow::comboAction( int action, const QString& url, const Q3CStrin
return;
KonqCombo *combo = 0L;
KonqMainWindow *window = s_lstViews->first();
while ( window ) {
if ( window->m_combo ) {
foreach ( KonqMainWindow* window, *s_lstViews ) {
if ( window && window->m_combo ) {
combo = window->m_combo;
switch ( action ) {
......@@ -3609,7 +3601,6 @@ void KonqMainWindow::comboAction( int action, const QString& url, const Q3CStrin
break;
}
}
window = s_lstViews->next();
}
// only one instance should save...
......@@ -4095,7 +4086,7 @@ void KonqMainWindow::updateViewActions()
m_paActivateNextTab->setEnabled( state );
m_paActivatePrevTab->setEnabled( state );
Q3PtrList<KonqFrameBase>* childFrameList = tabContainer->childFrameList();
QList<KonqFrameBase*>* childFrameList = tabContainer->childFrameList();
m_paMoveTabLeft->setEnabled( currentView() ? currentView()->frame()!=
(QApplication::isRightToLeft() ? childFrameList->last() : childFrameList->first()) : false );
m_paMoveTabRight->setEnabled( currentView() ? currentView()->frame()!=
......@@ -4451,17 +4442,14 @@ void KonqExtendedBookmarkOwner::slotFillBookmarksList( KExtendedBookmarkOwner::Q
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(docContainer);
Q3PtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
Q3PtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqFrameBase* frame, *tabContainer->childFrameList() )
{
if ( !it.current()->activeChildView() )
if ( !frame || !frame->activeChildView() )
continue;
if( it.current()->activeChildView()->locationBarURL().isEmpty() )
if( frame->activeChildView()->locationBarURL().isEmpty() )
continue;
list << qMakePair( it.current()->activeChildView()->caption(),
it.current()->activeChildView()->url().url() );
list << qMakePair( frame->activeChildView()->caption(),
frame->activeChildView()->url().url() );
}
}
......
......@@ -30,7 +30,7 @@
#include <QPixmap>
#include <Q3CString>
#include <QCloseEvent>
#include <Q3PtrList>
#include <QList>
#include <QEvent>
#include <QLabel>
#include <QCustomEvent>
......@@ -252,7 +252,7 @@ public:
bool saveViewPropertiesLocally() const { return m_bSaveViewPropertiesLocally; }
static Q3PtrList<KonqMainWindow> *mainWindowList() { return s_lstViews; }
static QList<KonqMainWindow*> *mainWindowList() { return s_lstViews; }
// public for konq_guiclients
void viewCountChanged();
......@@ -523,7 +523,7 @@ protected Q_SLOTS:
protected:
virtual bool eventFilter(QObject*obj,QEvent *ev);
void fillHistoryPopup( QMenu *menu, const Q3PtrList<HistoryEntry> &history );
void fillHistoryPopup( QMenu *menu, const QList<HistoryEntry*> &history );
bool makeViewsFollow( const KUrl & url, const KParts::URLArgs &args, const QString & serviceType,
KonqView * senderView );
......@@ -751,7 +751,7 @@ private:
static QStringList *s_plstAnimatedLogo;
static Q3PtrList<KonqMainWindow> *s_lstViews;
static QList<KonqMainWindow*> *s_lstViews;
QString m_currentDir; // stores current dir for relative URLs whenever applicable
......
......@@ -51,17 +51,16 @@
// Terminates fullscreen-mode for any full-screen window on the current desktop
void KonqMisc::abortFullScreenMode()
{
Q3PtrList<KonqMainWindow> *mainWindows = KonqMainWindow::mainWindowList();
QList<KonqMainWindow*> *mainWindows = KonqMainWindow::mainWindowList();
if ( mainWindows )
{
Q3PtrListIterator<KonqMainWindow> it( *mainWindows );
for (; it.current(); ++it )
foreach ( KonqMainWindow* window, *mainWindows )
{
if ( it.current()->fullScreenMode() )
if ( window->fullScreenMode() )
{
KWin::WindowInfo info = KWin::windowInfo( it.current()->winId(), NET::WMDesktop );
KWin::WindowInfo info = KWin::windowInfo( window->winId(), NET::WMDesktop );
if ( info.valid() && info.isOnCurrentDesktop() )
it.current()->showNormal();
window->showNormal();
}
}
}
......
......@@ -73,8 +73,7 @@ KonqFrameTabs::KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* parentCont
//kDebug(1202) << "KonqFrameTabs::KonqFrameTabs()" << endl;
m_pParentContainer = parentContainer;
m_pChildFrameList = new Q3PtrList<KonqFrameBase>;
m_pChildFrameList->setAutoDelete(false);
m_pChildFrameList = new QList<KonqFrameBase*>;
m_pActiveChild = 0L;
m_pViewManager = viewManager;
......@@ -181,13 +180,14 @@ KonqFrameTabs::KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* parentCont
KonqFrameTabs::~KonqFrameTabs()
{
//kDebug(1202) << "KonqFrameTabs::~KonqFrameTabs() " << this << " - " << className() << endl;
m_pChildFrameList->setAutoDelete(true);
qDeleteAll( *m_pChildFrameList );
m_pChildFrameList->clear();
delete m_pChildFrameList;
}
void KonqFrameTabs::listViews( ChildViewList *viewList ) {
for( Q3PtrListIterator<KonqFrameBase> it( *m_pChildFrameList ); *it; ++it )
it.current()->listViews(viewList);
foreach ( KonqFrameBase* frame, *m_pChildFrameList )
frame->listViews(viewList);
}
void KonqFrameTabs::saveConfig( KConfig* config, const QString &prefix, bool saveURLs,
......@@ -197,12 +197,12 @@ void KonqFrameTabs::saveConfig( KConfig* config, const QString &prefix, bool sav
QStringList strlst;
int i = 0;
QString newPrefix;
for (KonqFrameBase* it = m_pChildFrameList->first(); it; it = m_pChildFrameList->next())
foreach (KonqFrameBase* frame, *m_pChildFrameList)
{
newPrefix = QString::fromLatin1( it->frameType() ) + "T" + QString::number(i);
newPrefix = QString::fromLatin1( frame->frameType() ) + "T" + QString::number(i);
strlst.append( newPrefix );
newPrefix.append( QLatin1Char( '_' ) );
it->saveConfig( config, newPrefix, saveURLs, docContainer, id, depth + i );
frame->saveConfig( config, newPrefix, saveURLs, docContainer, id, depth + i );
i++;
}
......@@ -219,7 +219,7 @@ void KonqFrameTabs::copyHistory( KonqFrameBase *other )
return;
}
for (uint i = 0; i < m_pChildFrameList->count(); i++ )
for (int i = 0; i < m_pChildFrameList->count(); i++ )
{
m_pChildFrameList->at(i)->copyHistory( static_cast<KonqFrameTabs *>( other )->m_pChildFrameList->at(i) );
}
......@@ -404,9 +404,9 @@ void KonqFrameTabs::refreshSubPopupMenuTab()
SLOT( slotReloadAllTabs() ),
m_pViewManager->mainWindow()->action("reload_all_tabs")->shortcut() );
m_pSubPopupMenuTab->insertSeparator();
for (KonqFrameBase* it = m_pChildFrameList->first(); it; it = m_pChildFrameList->next())
foreach (KonqFrameBase* frameBase, *m_pChildFrameList)
{
KonqFrame* frame = dynamic_cast<KonqFrame *>(it);
KonqFrame* frame = dynamic_cast<KonqFrame *>(frameBase);
if ( frame && frame->activeChildView() )
{
QString title = frame->title().trimmed();
......
......@@ -29,7 +29,7 @@
#include <QPixmap>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <Q3PtrList>
#include <QList>
class QPixmap;
class QMenu;
......@@ -63,7 +63,7 @@ public:
virtual void printFrameInfo( const QString& spaces );
Q3PtrList<KonqFrameBase>* childFrameList() { return m_pChildFrameList; }
QList<KonqFrameBase*>* childFrameList() { return m_pChildFrameList; }
virtual void setTitle( const QString &title, QWidget* sender );
virtual void setTabIcon( const QString &url, QWidget* sender );
......@@ -103,7 +103,7 @@ protected:
void refreshSubPopupMenuTab();
void hideTabBar();
Q3PtrList<KonqFrameBase>* m_pChildFrameList;
QList<KonqFrameBase*>* m_pChildFrameList;
private Q_SLOTS:
void slotContextMenu( const QPoint& );
......
......@@ -567,17 +567,15 @@ void KonqViewManager::removeTab( KonqFrameBase* tab )
tabContainer->removeChildFrame(currentFrame);
Q3PtrList<KonqView> viewList;
Q3PtrListIterator<KonqView> it( viewList );
QList<KonqView*> viewList;
currentFrame->listViews( &viewList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqView* view, viewList )
{
if (it.current() == m_pMainWindow->currentView())
if (view == m_pMainWindow->currentView())
setActivePart( 0L, true );
m_pMainWindow->removeChildView( it.current() );
delete it.current();
m_pMainWindow->removeChildView( view );
delete view;
}
delete currentFrame;
......@@ -598,15 +596,12 @@ void KonqViewManager::reloadAllTabs( )
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
Q3PtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
Q3PtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqFrameBase* frame, *tabContainer->childFrameList() )
{
if ( it.current()->activeChildView())
if ( frame && frame->activeChildView())
{
if( !it.current()->activeChildView()->locationBarURL().isEmpty())
it.current()->activeChildView()->openURL( it.current()->activeChildView()->url(),it.current()->activeChildView()->locationBarURL());
if( !frame->activeChildView()->locationBarURL().isEmpty())
frame->activeChildView()->openURL( frame->activeChildView()->url(), frame->activeChildView()->locationBarURL());
}
}
}
......@@ -630,13 +625,10 @@ void KonqViewManager::removeOtherTabs( KonqFrameBase* tab )
return;
}
Q3PtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
Q3PtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqFrameBase* frame, *tabContainer->childFrameList() )
{
if( it.current() != currentFrame )
removeTab(it.current());
if ( frame && frame != currentFrame )
removeTab(frame);
}
}
......@@ -728,12 +720,11 @@ void KonqViewManager::updatePixmaps()
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
Q3PtrList<KonqView> viewList;
Q3PtrListIterator<KonqView> it( viewList );
QList<KonqView*> viewList;
tabContainer->listViews( &viewList );
for ( it.toFirst(); it != 0L; ++it )
it.current()->setTabIcon( it.current()->locationBarURL() );
foreach ( KonqView* view, viewList )
view->setTabIcon( view->locationBarURL() );
}
void KonqViewManager::removeView( KonqView *view )
......@@ -918,17 +909,16 @@ void KonqViewManager::clear()
if (m_pMainWindow->childFrame() == 0L) return;
Q3PtrList<KonqView> viewList;
QList<KonqView*> viewList;
m_pMainWindow->listViews( &viewList );
kDebug(1202) << viewList.count() << " items" << endl;
Q3PtrListIterator<KonqView> it( viewList );
for ( it.toFirst(); it.current(); ++it ) {
m_pMainWindow->removeChildView( it.current() );
kDebug(1202) << "Deleting " << it.current() << endl;
delete it.current();
foreach ( KonqView* view, viewList ) {
m_pMainWindow->removeChildView( view );
kDebug(1202) << "Deleting " << view << endl;
delete view;
}
kDebug(1202) << "deleting mainFrame " << endl;
......@@ -1151,11 +1141,9 @@ void KonqViewManager::loadViewProfile( KConfig &cfg, const QString & filename,
}
KonqView *originalView = m_pMainWindow->currentView();
Q3PtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
Q3PtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqFrameBase* frame, *tabContainer->childFrameList() )
{
KonqView *view = it.current()->activeChildView();
KonqView *view = frame->activeChildView();
if (view && view->part() && (view->part()->metaObject()->indexOfProperty("modified") != -1)) {
QVariant prop = view->part()->property("modified");
if (prop.isValid() && prop.toBool()) {
......@@ -1768,18 +1756,15 @@ void KonqViewManager::showHTML(bool b)
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
Q3PtrList<KonqFrameBase> frameList = *tabContainer->childFrameList();
Q3PtrListIterator<KonqFrameBase> it( frameList );
for ( it.toFirst(); it != 0L; ++it )
foreach ( KonqFrameBase* frame, *tabContainer->childFrameList() )
{
if ( it.current()->activeChildView() && it.current()->activeChildView() !=m_pMainWindow->currentView())
if ( frame && frame->activeChildView() && frame->activeChildView() != m_pMainWindow->currentView())
{
it.current()->activeChildView()->setAllowHTML( b );
if( !it.current()->activeChildView()->locationBarURL().isEmpty())
frame->activeChildView()->setAllowHTML( b );
if( !frame->activeChildView()->locationBarURL().isEmpty())
{
m_pMainWindow->showHTML( it.current()->activeChildView(), b, false );
m_pMainWindow->showHTML( frame->activeChildView(), b, false );
}
}
}
......
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