summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kview/modules/presenter/kviewpresenter.cpp29
-rw-r--r--kview/modules/presenter/kviewpresenter.h11
2 files changed, 18 insertions, 22 deletions
diff --git a/kview/modules/presenter/kviewpresenter.cpp b/kview/modules/presenter/kviewpresenter.cpp
index c05490bb..99083b6d 100644
--- a/kview/modules/presenter/kviewpresenter.cpp
+++ b/kview/modules/presenter/kviewpresenter.cpp
@@ -60,7 +60,6 @@ KViewPresenter::KViewPresenter( TQObject* parent, const char* name, const TQStri
, m_pSlideshowTimer( new TQTimer( this ) )
{
kdDebug( 4630 ) << k_funcinfo << endl;
- m_imagelist.setAutoDelete( true );
TQObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
@@ -190,14 +189,12 @@ bool KViewPresenter::eventFilter( TQObject *obj, TQEvent *ev )
{
for( TQStringList::const_iterator it = l.begin(); it != l.end(); ++it )
{
- ImageInfo * info = new ImageInfo( KURL( *it ) );
+ ImageInfo info = ImageInfo( KURL( *it ) );
if( ! m_imagelist.contains( info ) )
{
- m_imagelist.inSort( info );
+ m_imagelist.append( info );
( void )new ImageListItem( m_pImageList->m_pListView, KURL( *it ) );
}
- else
- delete info;
}
return true;
}
@@ -217,15 +214,13 @@ void KViewPresenter::slotImageOpened( const KURL & url )
if( ! m_bDontAdd )
{
kdDebug( 4630 ) << k_funcinfo << "imagelist:" << endl;
- ImageInfo * info = new ImageInfo( url );
+ ImageInfo info = ImageInfo( url );
if( ! m_imagelist.contains( info ) )
{
- m_imagelist.inSort( info );
+ m_imagelist.append( info );
TQListViewItem * item = new ImageListItem( m_pImageList->m_pListView, url );
makeCurrent( item );
}
- else
- delete info;
}
}
@@ -247,14 +242,12 @@ void KViewPresenter::slotOpenFiles()
m_pViewer->openURL( *it );
for( ++it; it != urls.end(); ++it )
{
- ImageInfo * info = new ImageInfo( *it );
+ ImageInfo info = ImageInfo( *it );
if( ! m_imagelist.contains( info ) )
{
- m_imagelist.inSort( info );
+ m_imagelist.append( info );
( void )new ImageListItem( m_pImageList->m_pListView, *it );
}
- else
- delete info;
}
}
@@ -265,7 +258,7 @@ void KViewPresenter::slotClose()
next = 0;
ImageInfo info( m_pCurrentItem->url() );
- m_imagelist.remove( &info );
+ m_imagelist.remove( info );
delete m_pCurrentItem;
m_pCurrentItem = 0;
@@ -285,7 +278,7 @@ void KViewPresenter::changeItem( TQListViewItem * qitem )
{
kdDebug( 4630 ) << "file doesn't exist. removed." << endl;
ImageInfo info( item->url() );
- m_imagelist.remove( &info );
+ m_imagelist.remove( info );
if( m_pCurrentItem == item )
{
TQListViewItem * next = m_pCurrentItem->itemBelow() ? m_pCurrentItem->itemBelow() : m_pImageList->m_pListView->firstChild();
@@ -430,14 +423,12 @@ void KViewPresenter::loadList()
while( ! t.eof() )
{
KURL url ( t.readLine() );
- ImageInfo * info = new ImageInfo( url );
+ ImageInfo info = ImageInfo( url );
if( ! m_imagelist.contains( info ) )
{
- m_imagelist.inSort( info );
+ m_imagelist.append( info );
( void )new ImageListItem( m_pImageList->m_pListView, url );
}
- else
- delete info;
}
}
else
diff --git a/kview/modules/presenter/kviewpresenter.h b/kview/modules/presenter/kviewpresenter.h
index 2adee4fb..5bb3e953 100644
--- a/kview/modules/presenter/kviewpresenter.h
+++ b/kview/modules/presenter/kviewpresenter.h
@@ -24,7 +24,7 @@
#include <tdeparts/plugin.h>
#include <kurl.h>
-#include <tqptrlist.h>
+#include <tqvaluelist.h>
namespace KImageViewer { class Viewer; }
@@ -47,6 +47,11 @@ protected:
struct ImageInfo
{
KURL url;
+
+ ImageInfo()
+ : url()
+ {
+ }
ImageInfo( const KURL & url )
: url( url )
{
@@ -57,7 +62,7 @@ protected:
}
bool operator!=( const ImageInfo & i1 )
{
- return url.prettyURL() == i1.url.prettyURL();
+ return url.prettyURL() != i1.url.prettyURL();
}
bool operator>( const ImageInfo & i1 )
{
@@ -94,7 +99,7 @@ private:
TDEAction * m_paFileOpen;
TDEAction * m_paFileClose;
- TQPtrList<ImageInfo> m_imagelist;
+ TQValueList<ImageInfo> m_imagelist;
bool m_bDontAdd;
ImageListItem * m_pCurrentItem;
TQTimer * m_pSlideshowTimer;