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