00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "konq_dirpart.h"
00021 #include "konq_bgnddlg.h"
00022 #include "konq_propsview.h"
00023 #include "konq_settings.h"
00024
00025 #include <kio/paste.h>
00026 #include <kapplication.h>
00027 #include <kaction.h>
00028 #include <kdatastream.h>
00029 #include <kdebug.h>
00030 #include <kdirlister.h>
00031 #include <kiconloader.h>
00032 #include <klocale.h>
00033 #include <kmessagebox.h>
00034 #include <konq_drag.h>
00035 #include <kparts/browserextension.h>
00036 #include <kurldrag.h>
00037 #include <kuserprofile.h>
00038 #include <kurifilter.h>
00039 #include <kglobalsettings.h>
00040
00041 #include <qapplication.h>
00042 #include <qclipboard.h>
00043 #include <qfile.h>
00044 #include <assert.h>
00045 #include <qvaluevector.h>
00046
00047 class KonqDirPart::KonqDirPartPrivate
00048 {
00049 public:
00050 KonqDirPartPrivate() : dirLister( 0 ) {}
00051 QStringList mimeFilters;
00052 KToggleAction *aEnormousIcons;
00053 KToggleAction *aSmallMediumIcons;
00054 QValueVector<int> iconSize;
00055
00056 KDirLister* dirLister;
00057 bool dirSizeDirty;
00058
00059 void findAvailableIconSizes(void);
00060 int findNearestIconSize(int size);
00061 int nearestIconSizeError(int size);
00062 };
00063
00064 void KonqDirPart::KonqDirPartPrivate::findAvailableIconSizes(void)
00065 {
00066 KIconTheme *root = KGlobal::instance()->iconLoader()->theme();
00067 iconSize.resize(1);
00068 if (root) {
00069 QValueList<int> avSizes = root->querySizes(KIcon::Desktop);
00070 kdDebug(1203) << "The icon theme handles the sizes:" << avSizes << endl;
00071 qHeapSort(avSizes);
00072 int oldSize = -1;
00073 if (avSizes.count() < 10) {
00074
00075 QValueListConstIterator<int> i;
00076 for (i = avSizes.begin(); i != avSizes.end(); i++) {
00077
00078 if (*i != oldSize) iconSize.append(*i);
00079 oldSize = *i;
00080 }
00081 } else {
00082
00083 const int progression[] = {16, 22, 32, 48, 64, 96, 128, 192, 256};
00084
00085 QValueListConstIterator<int> j = avSizes.begin();
00086 for (uint i = 0; i < 9; i++) {
00087 while (j++ != avSizes.end()) {
00088 if (*j >= progression[i]) {
00089 iconSize.append(*j);
00090 kdDebug(1203) << "appending " << *j << " size." << endl;
00091 break;
00092 }
00093 }
00094 }
00095 }
00096 } else {
00097 iconSize.append(KIcon::SizeSmall);
00098 iconSize.append(KIcon::SizeMedium);
00099 iconSize.append(KIcon::SizeLarge);
00100 iconSize.append(KIcon::SizeHuge);
00101 }
00102 kdDebug(1203) << "Using " << iconSize.count() << " icon sizes." << endl;
00103 }
00104
00105 int KonqDirPart::KonqDirPartPrivate::findNearestIconSize(int preferred)
00106 {
00107 int s1 = iconSize[1];
00108 if (preferred == 0) return KGlobal::iconLoader()->currentSize(KIcon::Desktop);
00109 if (preferred <= s1) return s1;
00110 for (uint i = 2; i <= iconSize.count(); i++) {
00111 if (preferred <= iconSize[i]) {
00112 if (preferred - s1 < iconSize[i] - preferred) return s1;
00113 else return iconSize[i];
00114 } else {
00115 s1 = iconSize[i];
00116 }
00117 }
00118 return s1;
00119 }
00120
00121 int KonqDirPart::KonqDirPartPrivate::nearestIconSizeError(int size)
00122 {
00123 return QABS(size - findNearestIconSize(size));
00124 }
00125
00126 KonqDirPart::KonqDirPart( QObject *parent, const char *name )
00127 :KParts::ReadOnlyPart( parent, name ),
00128 m_pProps( 0L ),
00129 m_findPart( 0L )
00130 {
00131 d = new KonqDirPartPrivate;
00132 resetCount();
00133
00134
00135 connect( QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slotClipboardDataChanged()) );
00136
00137 actionCollection()->setHighlightingEnabled( true );
00138
00139 m_paIncIconSize = new KAction( i18n( "Enlarge Icons" ), "viewmag+", 0, this, SLOT( slotIncIconSize() ), actionCollection(), "incIconSize" );
00140 m_paDecIconSize = new KAction( i18n( "Shrink Icons" ), "viewmag-", 0, this, SLOT( slotDecIconSize() ), actionCollection(), "decIconSize" );
00141
00142 m_paDefaultIcons = new KRadioAction( i18n( "&Default Size" ), 0, actionCollection(), "modedefault" );
00143 d->aEnormousIcons = new KRadioAction( i18n( "&Huge" ), 0,
00144 actionCollection(), "modeenormous" );
00145 m_paHugeIcons = new KRadioAction( i18n( "&Very Large" ), 0, actionCollection(), "modehuge" );
00146 m_paLargeIcons = new KRadioAction( i18n( "&Large" ), 0, actionCollection(), "modelarge" );
00147 m_paMediumIcons = new KRadioAction( i18n( "&Medium" ), 0, actionCollection(), "modemedium" );
00148 d->aSmallMediumIcons = new KRadioAction( i18n( "&Small" ), 0,
00149 actionCollection(), "modesmallmedium" );
00150 m_paSmallIcons = new KRadioAction( i18n( "&Tiny" ), 0, actionCollection(), "modesmall" );
00151
00152 m_paDefaultIcons->setExclusiveGroup( "ViewMode" );
00153 d->aEnormousIcons->setExclusiveGroup( "ViewMode" );
00154 m_paHugeIcons->setExclusiveGroup( "ViewMode" );
00155 m_paLargeIcons->setExclusiveGroup( "ViewMode" );
00156 m_paMediumIcons->setExclusiveGroup( "ViewMode" );
00157 d->aSmallMediumIcons->setExclusiveGroup( "ViewMode" );
00158 m_paSmallIcons->setExclusiveGroup( "ViewMode" );
00159
00160 connect( m_paDefaultIcons, SIGNAL( toggled( bool ) ), this, SLOT( slotIconSizeToggled( bool ) ) );
00161 connect( d->aEnormousIcons, SIGNAL( toggled( bool ) ),
00162 this, SLOT( slotIconSizeToggled( bool ) ) );
00163 connect( m_paHugeIcons, SIGNAL( toggled( bool ) ), this, SLOT( slotIconSizeToggled( bool ) ) );
00164 connect( m_paLargeIcons, SIGNAL( toggled( bool ) ), this, SLOT( slotIconSizeToggled( bool ) ) );
00165 connect( m_paMediumIcons, SIGNAL( toggled( bool ) ), this, SLOT( slotIconSizeToggled( bool ) ) );
00166 connect( d->aSmallMediumIcons, SIGNAL( toggled( bool ) ),
00167 this, SLOT( slotIconSizeToggled( bool ) ) );
00168 connect( m_paSmallIcons, SIGNAL( toggled( bool ) ), this, SLOT( slotIconSizeToggled( bool ) ) );
00169
00170 connect( kapp, SIGNAL(iconChanged(int)), SLOT(slotIconChanged(int)) );
00171 #if 0
00172
00173
00174
00175 int i;
00176 d->iconSize[0] = 0;
00177 d->iconSize[1] = KIcon::SizeSmall;
00178 d->iconSize[2] = KIcon::SizeSmallMedium;
00179 d->iconSize[3] = KIcon::SizeMedium;
00180 d->iconSize[4] = KIcon::SizeLarge;
00181 d->iconSize[5] = KIcon::SizeHuge;
00182 d->iconSize[6] = KIcon::SizeEnormous;
00183 d->iconSize[7] = 192;
00184 d->iconSize[8] = 256;
00185 KIconTheme *root = KGlobal::instance()->iconLoader()->theme();
00186 if (root)
00187 {
00188 QValueList<int> avSizes = root->querySizes(KIcon::Desktop);
00189 kdDebug(1203) << "the icon theme handles the following sizes:" << avSizes << endl;
00190 if (avSizes.count() < 10) {
00191
00192
00193
00194 QValueList<int>::Iterator it;
00195 for (i=1, it=avSizes.begin(); (it!=avSizes.end()) && (i<7); it++, i++)
00196 {
00197 d->iconSize[i] = *it;
00198 kdDebug(1203) << "m_iIconSize[" << i << "] = " << *it << endl;
00199 }
00200
00201 for (; i < 7; i++) {
00202 d->iconSize[i] = d->iconSize[i - 1] + d->iconSize[i - 1] / 2 ;
00203 kdDebug(1203) << "m_iIconSize[" << i << "] = " << d->iconSize[i] << endl;
00204 }
00205 }
00206 }
00207 #else
00208 d->iconSize.reserve(10);
00209 d->iconSize.append(0);
00210 adjustIconSizes();
00211 #endif
00212
00213
00214
00215 m_iIconSize[1] = KIcon::SizeSmall;
00216 m_iIconSize[2] = KIcon::SizeMedium;
00217 m_iIconSize[3] = KIcon::SizeLarge;
00218 m_iIconSize[4] = KIcon::SizeHuge;
00219
00220
00221 KAction *a = new KAction( i18n( "Configure Background..." ), "background", 0, this, SLOT( slotBackgroundSettings() ),
00222 actionCollection(), "bgsettings" );
00223
00224 a->setToolTip( i18n( "Allows choosing of background settings for this view" ) );
00225 }
00226
00227 KonqDirPart::~KonqDirPart()
00228 {
00229
00230 delete m_findPart;
00231 delete d;
00232 }
00233
00234 void KonqDirPart::adjustIconSizes()
00235 {
00236 d->findAvailableIconSizes();
00237 m_paSmallIcons->setEnabled(d->findNearestIconSize(16) < 20);
00238 d->aSmallMediumIcons->setEnabled(d->nearestIconSizeError(22) < 2);
00239 m_paMediumIcons->setEnabled(d->nearestIconSizeError(32) < 6);
00240 m_paLargeIcons->setEnabled(d->nearestIconSizeError(48) < 8);
00241 m_paHugeIcons->setEnabled(d->nearestIconSizeError(64) < 12);
00242 d->aEnormousIcons->setEnabled(d->findNearestIconSize(128) > 110);
00243
00244 if (m_pProps) {
00245 int size = m_pProps->iconSize();
00246 int nearSize = d->findNearestIconSize(size);
00247
00248 if (size != nearSize) {
00249 m_pProps->setIconSize(nearSize);
00250 }
00251 newIconSize(nearSize);
00252 }
00253 }
00254
00255 void KonqDirPart::setMimeFilter (const QStringList& mime)
00256 {
00257 QString u = url().url();
00258
00259 if ( u.isEmpty () )
00260 return;
00261
00262 if ( mime.isEmpty() )
00263 d->mimeFilters.clear();
00264 else
00265 d->mimeFilters = mime;
00266 }
00267
00268 QStringList KonqDirPart::mimeFilter() const
00269 {
00270 return d->mimeFilters;
00271 }
00272
00273 QScrollView * KonqDirPart::scrollWidget()
00274 {
00275 return static_cast<QScrollView *>(widget());
00276 }
00277
00278 void KonqDirPart::slotBackgroundSettings()
00279 {
00280 QColor bgndColor = m_pProps->bgColor( widget() );
00281 QColor defaultColor = KGlobalSettings::baseColor();
00282 KonqBgndDialog dlg( widget(), m_pProps->bgPixmapFile(), bgndColor, defaultColor );
00283 if ( dlg.exec() == KonqBgndDialog::Accepted )
00284 {
00285 if ( dlg.color().isValid() )
00286 {
00287 m_pProps->setBgColor( dlg.color() );
00288 m_pProps->setBgPixmapFile( "" );
00289 }
00290 else
00291 {
00292 m_pProps->setBgColor( defaultColor );
00293 m_pProps->setBgPixmapFile( dlg.pixmapFile() );
00294 }
00295 m_pProps->applyColors( scrollWidget()->viewport() );
00296 scrollWidget()->viewport()->repaint();
00297 }
00298 }
00299
00300 void KonqDirPart::lmbClicked( KFileItem * fileItem )
00301 {
00302 KURL url = fileItem->url();
00303 if ( !fileItem->isReadable() )
00304 {
00305
00306 if ( ( !fileItem->isLocalFile() ) || QFile::exists( url.path() ) )
00307 {
00308 KMessageBox::error( widget(), i18n("<p>You do not have enough permissions to read <b>%1</b></p>").arg(url.prettyURL()) );
00309 return;
00310 }
00311 KMessageBox::error( widget(), i18n("<p><b>%1</b> does not seem to exist anymore</p>").arg(url.prettyURL()) );
00312 return;
00313 }
00314
00315 KParts::URLArgs args;
00316 fileItem->determineMimeType();
00317 if ( fileItem->isMimeTypeKnown() )
00318 args.serviceType = fileItem->mimetype();
00319 args.trustedSource = true;
00320
00321 if (KonqFMSettings::settings()->alwaysNewWin() && fileItem->isDir()) {
00322
00323
00324
00325
00326
00327
00328 KParts::WindowArgs wargs;
00329 KParts::ReadOnlyPart* dummy;
00330 emit m_extension->createNewWindow( url, args, wargs, dummy );
00331 }
00332 else
00333 {
00334 kdDebug() << "emit m_extension->openURLRequest( " << url.url() << "," << args.serviceType << ")" << endl;
00335 emit m_extension->openURLRequest( url, args );
00336 }
00337 }
00338
00339 void KonqDirPart::mmbClicked( KFileItem * fileItem )
00340 {
00341 if ( fileItem )
00342 {
00343
00344
00345 KService::Ptr offer = KServiceTypeProfile::preferredService(fileItem->mimetype(), "Application");
00346
00347 if ( offer && offer->desktopEntryName().startsWith("kfmclient") )
00348 {
00349 KParts::URLArgs args;
00350 args.serviceType = fileItem->mimetype();
00351 emit m_extension->createNewWindow( fileItem->url(), args );
00352 }
00353 else
00354 fileItem->run();
00355 }
00356 else
00357 {
00358 m_extension->pasteRequest();
00359 }
00360 }
00361
00362 void KonqDirPart::saveState( QDataStream& stream )
00363 {
00364 stream << m_nameFilter;
00365 }
00366
00367 void KonqDirPart::restoreState( QDataStream& stream )
00368 {
00369 stream >> m_nameFilter;
00370 }
00371
00372 void KonqDirPart::saveFindState( QDataStream& stream )
00373 {
00374
00375
00376 if ( !m_findPart )
00377 return;
00378
00379
00380
00381 stream << m_url;
00382
00383 KParts::BrowserExtension* ext = KParts::BrowserExtension::childObject( m_findPart );
00384 if( !ext )
00385 return;
00386
00387 ext->saveState( stream );
00388 }
00389
00390 void KonqDirPart::restoreFindState( QDataStream& stream )
00391 {
00392
00393 stream >> m_url;
00394
00395 emit findOpen( this );
00396
00397 KParts::BrowserExtension* ext = KParts::BrowserExtension::childObject( m_findPart );
00398 slotClear();
00399
00400 if( !ext )
00401 return;
00402
00403 ext->restoreState( stream );
00404 }
00405
00406 void KonqDirPart::slotClipboardDataChanged()
00407 {
00408
00409
00410 KURL::List lst;
00411 QMimeSource *data = QApplication::clipboard()->data();
00412 if ( data->provides( "application/x-kde-cutselection" ) && data->provides( "text/uri-list" ) )
00413 if ( KonqDrag::decodeIsCutSelection( data ) )
00414 (void) KURLDrag::decode( data, lst );
00415
00416 disableIcons( lst );
00417
00418 updatePasteAction();
00419 }
00420
00421 void KonqDirPart::updatePasteAction()
00422 {
00423 QString actionText = KIO::pasteActionText();
00424 bool paste = !actionText.isEmpty();
00425 if ( paste )
00426 emit m_extension->setActionText( "paste", actionText );
00427 emit m_extension->enableAction( "paste", paste );
00428 }
00429
00430 void KonqDirPart::newItems( const KFileItemList & entries )
00431 {
00432 d->dirSizeDirty = true;
00433 if ( m_findPart )
00434 emitTotalCount();
00435
00436 emit itemsAdded( entries );
00437 }
00438
00439 void KonqDirPart::deleteItem( KFileItem * fileItem )
00440 {
00441 d->dirSizeDirty = true;
00442 emit itemRemoved( fileItem );
00443 }
00444
00445 void KonqDirPart::emitTotalCount()
00446 {
00447 if ( !d->dirLister || d->dirLister->url().isEmpty() )
00448 return;
00449 if ( d->dirSizeDirty ) {
00450 m_lDirSize = 0;
00451 m_lFileCount = 0;
00452 m_lDirCount = 0;
00453 KFileItemList entries = d->dirLister->items();
00454 for (KFileItemListIterator it(entries); it.current(); ++it)
00455 {
00456 if ( !it.current()->isDir() )
00457 {
00458 if (!it.current()->isLink())
00459 m_lDirSize += it.current()->size();
00460 m_lFileCount++;
00461 }
00462 else
00463 m_lDirCount++;
00464 }
00465 d->dirSizeDirty = false;
00466 }
00467
00468 QString summary =
00469 KIO::itemsSummaryString(m_lFileCount + m_lDirCount,
00470 m_lFileCount,
00471 m_lDirCount,
00472 m_lDirSize,
00473 true);
00474 bool bShowsResult = false;
00475 if (m_findPart)
00476 {
00477 QVariant prop = m_findPart->property( "showsResult" );
00478 bShowsResult = prop.isValid() && prop.toBool();
00479 }
00480
00481 emit setStatusBarText( bShowsResult ? i18n("Search result: %1").arg(summary) : summary );
00482 }
00483
00484 void KonqDirPart::emitCounts( const KFileItemList & lst )
00485 {
00486 if ( lst.count() == 1 )
00487 emit setStatusBarText( ((KFileItemList)lst).first()->getStatusBarInfo() );
00488 else
00489 {
00490 long long fileSizeSum = 0;
00491 uint fileCount = 0;
00492 uint dirCount = 0;
00493
00494 for ( KFileItemListIterator it( lst ); it.current(); ++it )
00495 {
00496 if ( it.current()->isDir() )
00497 dirCount++;
00498 else
00499 {
00500 if ( !it.current()->isLink() )
00501 fileSizeSum += it.current()->size();
00502 fileCount++;
00503 }
00504 }
00505
00506 emit setStatusBarText( KIO::itemsSummaryString( fileCount + dirCount,
00507 fileCount, dirCount,
00508 fileSizeSum, true ) );
00509 }
00510 }
00511
00512 void KonqDirPart::emitCounts( const KFileItemList & lst, bool selectionChanged )
00513 {
00514 if ( lst.count() == 0 )
00515 emitTotalCount();
00516 else
00517 emitCounts( lst );
00518
00519
00520
00521
00522
00523
00524
00525
00526 if ( selectionChanged )
00527 emit m_extension->selectionInfo( lst );
00528 }
00529
00530 void KonqDirPart::emitMouseOver( const KFileItem* item )
00531 {
00532 emit m_extension->mouseOverInfo( item );
00533 }
00534
00535 void KonqDirPart::slotIconSizeToggled( bool toggleOn )
00536 {
00537
00538
00539
00540
00541
00542 if ( !toggleOn )
00543 return;
00544
00545 if ( m_paDefaultIcons->isChecked() )
00546 setIconSize(0);
00547 else if ( d->aEnormousIcons->isChecked() )
00548 setIconSize(d->findNearestIconSize(KIcon::SizeEnormous));
00549 else if ( m_paHugeIcons->isChecked() )
00550 setIconSize(d->findNearestIconSize(KIcon::SizeHuge));
00551 else if ( m_paLargeIcons->isChecked() )
00552 setIconSize(d->findNearestIconSize(KIcon::SizeLarge));
00553 else if ( m_paMediumIcons->isChecked() )
00554 setIconSize(d->findNearestIconSize(KIcon::SizeMedium));
00555 else if ( d->aSmallMediumIcons->isChecked() )
00556 setIconSize(d->findNearestIconSize(KIcon::SizeSmallMedium));
00557 else if ( m_paSmallIcons->isChecked() )
00558 setIconSize(d->findNearestIconSize(KIcon::SizeSmall));
00559 }
00560
00561 void KonqDirPart::slotIncIconSize()
00562 {
00563 int s = m_pProps->iconSize();
00564 s = s ? s : KGlobal::iconLoader()->currentSize( KIcon::Desktop );
00565 uint sizeIndex = 0;
00566 for ( uint idx = 1; idx < d->iconSize.count() ; ++idx )
00567 if (s == d->iconSize[idx]) {
00568 sizeIndex = idx;
00569 break;
00570 }
00571 if ( sizeIndex > 0 && sizeIndex < d->iconSize.count() - 1 )
00572 {
00573 setIconSize( d->iconSize[sizeIndex + 1] );
00574 }
00575 }
00576
00577 void KonqDirPart::slotDecIconSize()
00578 {
00579 int s = m_pProps->iconSize();
00580 s = s ? s : KGlobal::iconLoader()->currentSize( KIcon::Desktop );
00581 uint sizeIndex = 0;
00582 for ( uint idx = 1; idx < d->iconSize.count() ; ++idx )
00583 if (s == d->iconSize[idx]) {
00584 sizeIndex = idx;
00585 break;
00586 }
00587 if ( sizeIndex > 1 )
00588 {
00589 setIconSize( d->iconSize[sizeIndex - 1] );
00590 }
00591 }
00592
00593
00594 void KonqDirPart::newIconSize( int size )
00595 {
00596 int realSize = (size==0) ? KGlobal::iconLoader()->currentSize( KIcon::Desktop ) : size;
00597 m_paDecIconSize->setEnabled(realSize > d->iconSize[1]);
00598 m_paIncIconSize->setEnabled(realSize < d->iconSize.back());
00599
00600 m_paDefaultIcons->setChecked(size == 0);
00601 d->aEnormousIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeEnormous));
00602 m_paHugeIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeHuge));
00603 m_paLargeIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeLarge));
00604 m_paMediumIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeMedium));
00605 d->aSmallMediumIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeSmallMedium));
00606 m_paSmallIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeSmall));
00607 }
00608
00609
00610 void KonqDirPart::setIconSize( int size )
00611 {
00612
00613 m_pProps->setIconSize( size );
00614 newIconSize( size );
00615 }
00616
00617 bool KonqDirPart::closeURL()
00618 {
00619
00620 return doCloseURL();
00621 }
00622
00623 bool KonqDirPart::openURL(const KURL& url)
00624 {
00625 if ( m_findPart )
00626 {
00627 kdDebug(1203) << "KonqDirPart::openURL -> emit findClosed " << this << endl;
00628 delete m_findPart;
00629 m_findPart = 0L;
00630 emit findClosed( this );
00631 }
00632
00633 m_url = url;
00634 emit aboutToOpenURL ();
00635
00636 return doOpenURL(url);
00637 }
00638
00639 void KonqDirPart::setFindPart( KParts::ReadOnlyPart * part )
00640 {
00641 assert(part);
00642 m_findPart = part;
00643 connect( m_findPart, SIGNAL( started() ),
00644 this, SLOT( slotStarted() ) );
00645 connect( m_findPart, SIGNAL( started() ),
00646 this, SLOT( slotStartAnimationSearching() ) );
00647 connect( m_findPart, SIGNAL( clear() ),
00648 this, SLOT( slotClear() ) );
00649 connect( m_findPart, SIGNAL( newItems( const KFileItemList & ) ),
00650 this, SLOT( slotNewItems( const KFileItemList & ) ) );
00651 connect( m_findPart, SIGNAL( finished() ),
00652 this, SLOT( slotCompleted() ) );
00653 connect( m_findPart, SIGNAL( finished() ),
00654 this, SLOT( slotStopAnimationSearching() ) );
00655 connect( m_findPart, SIGNAL( canceled() ),
00656 this, SLOT( slotCanceled() ) );
00657 connect( m_findPart, SIGNAL( canceled() ),
00658 this, SLOT( slotStopAnimationSearching() ) );
00659
00660 connect( m_findPart, SIGNAL( findClosed() ),
00661 this, SLOT( slotFindClosed() ) );
00662
00663 emit findOpened( this );
00664
00665
00666 m_findPart->openURL( url() );
00667 }
00668
00669 void KonqDirPart::slotFindClosed()
00670 {
00671 kdDebug(1203) << "KonqDirPart::slotFindClosed -> emit findClosed " << this << endl;
00672 delete m_findPart;
00673 m_findPart = 0L;
00674 emit findClosed( this );
00675
00676 openURL( url() );
00677 }
00678
00679 void KonqDirPart::slotIconChanged( int group )
00680 {
00681 if (group != KIcon::Desktop) return;
00682 adjustIconSizes();
00683 }
00684
00685 void KonqDirPart::slotStartAnimationSearching()
00686 {
00687 started(0);
00688 }
00689
00690 void KonqDirPart::slotStopAnimationSearching()
00691 {
00692 completed();
00693 }
00694
00695 void KonqDirPartBrowserExtension::saveState( QDataStream &stream )
00696 {
00697 m_dirPart->saveState( stream );
00698 bool hasFindPart = m_dirPart->findPart();
00699 stream << hasFindPart;
00700 assert( ! ( hasFindPart && !strcmp(m_dirPart->className(), "KFindPart") ) );
00701 if ( !hasFindPart )
00702 KParts::BrowserExtension::saveState( stream );
00703 else {
00704 m_dirPart->saveFindState( stream );
00705 }
00706 }
00707
00708 void KonqDirPartBrowserExtension::restoreState( QDataStream &stream )
00709 {
00710 m_dirPart->restoreState( stream );
00711 bool hasFindPart;
00712 stream >> hasFindPart;
00713 assert( ! ( hasFindPart && !strcmp(m_dirPart->className(), "KFindPart") ) );
00714 if ( !hasFindPart )
00715
00716 KParts::BrowserExtension::restoreState( stream );
00717 else {
00718 m_dirPart->restoreFindState( stream );
00719 }
00720 }
00721
00722
00723 void KonqDirPart::resetCount()
00724 {
00725 m_lDirSize = 0;
00726 m_lFileCount = 0;
00727 m_lDirCount = 0;
00728 d->dirSizeDirty = true;
00729 }
00730
00731 void KonqDirPart::setDirLister( KDirLister* lister )
00732 {
00733 d->dirLister = lister;
00734 }
00735
00736 #include "konq_dirpart.moc"