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 ( fileItem->isLink() && fileItem->isLocalFile() )
00322 url = KURL( url, KURL::encode_string( fileItem->linkDest() ) );
00323
00324 if (KonqFMSettings::settings()->alwaysNewWin() && fileItem->isDir()) {
00325
00326
00327
00328
00329
00330
00331 KParts::WindowArgs wargs;
00332 KParts::ReadOnlyPart* dummy;
00333 emit m_extension->createNewWindow( url, args, wargs, dummy );
00334 }
00335 else
00336 {
00337 kdDebug() << "emit m_extension->openURLRequest( " << url.url() << "," << args.serviceType << ")" << endl;
00338 emit m_extension->openURLRequest( url, args );
00339 }
00340 }
00341
00342 void KonqDirPart::mmbClicked( KFileItem * fileItem )
00343 {
00344 if ( fileItem )
00345 {
00346
00347
00348 KService::Ptr offer = KServiceTypeProfile::preferredService(fileItem->mimetype(), "Application");
00349
00350 if ( offer && offer->desktopEntryName().startsWith("kfmclient") )
00351 {
00352 KParts::URLArgs args;
00353 args.serviceType = fileItem->mimetype();
00354 emit m_extension->createNewWindow( fileItem->url(), args );
00355 }
00356 else
00357 fileItem->run();
00358 }
00359 else
00360 {
00361 m_extension->pasteRequest();
00362 }
00363 }
00364
00365 void KonqDirPart::saveState( QDataStream& stream )
00366 {
00367 stream << m_nameFilter;
00368 }
00369
00370 void KonqDirPart::restoreState( QDataStream& stream )
00371 {
00372 stream >> m_nameFilter;
00373 }
00374
00375 void KonqDirPart::saveFindState( QDataStream& stream )
00376 {
00377
00378
00379 if ( !m_findPart )
00380 return;
00381
00382
00383
00384 stream << m_url;
00385
00386 KParts::BrowserExtension* ext = KParts::BrowserExtension::childObject( m_findPart );
00387 if( !ext )
00388 return;
00389
00390 ext->saveState( stream );
00391 }
00392
00393 void KonqDirPart::restoreFindState( QDataStream& stream )
00394 {
00395
00396 stream >> m_url;
00397
00398 emit findOpen( this );
00399
00400 KParts::BrowserExtension* ext = KParts::BrowserExtension::childObject( m_findPart );
00401 slotClear();
00402
00403 if( !ext )
00404 return;
00405
00406 ext->restoreState( stream );
00407 }
00408
00409 void KonqDirPart::slotClipboardDataChanged()
00410 {
00411
00412
00413 KURL::List lst;
00414 QMimeSource *data = QApplication::clipboard()->data();
00415 if ( data->provides( "application/x-kde-cutselection" ) && data->provides( "text/uri-list" ) )
00416 if ( KonqDrag::decodeIsCutSelection( data ) )
00417 (void) KURLDrag::decode( data, lst );
00418
00419 disableIcons( lst );
00420
00421 updatePasteAction();
00422 }
00423
00424 void KonqDirPart::updatePasteAction()
00425 {
00426 QString actionText = KIO::pasteActionText();
00427 bool paste = !actionText.isEmpty();
00428 if ( paste )
00429 emit m_extension->setActionText( "paste", actionText );
00430 emit m_extension->enableAction( "paste", paste );
00431 }
00432
00433 void KonqDirPart::newItems( const KFileItemList & entries )
00434 {
00435 d->dirSizeDirty = true;
00436 if ( m_findPart )
00437 emitTotalCount();
00438
00439 emit itemsAdded( entries );
00440 }
00441
00442 void KonqDirPart::deleteItem( KFileItem * fileItem )
00443 {
00444 d->dirSizeDirty = true;
00445 emit itemRemoved( fileItem );
00446 }
00447
00448 void KonqDirPart::emitTotalCount()
00449 {
00450 if ( !d->dirLister || d->dirLister->url().isEmpty() )
00451 return;
00452 if ( d->dirSizeDirty ) {
00453 m_lDirSize = 0;
00454 m_lFileCount = 0;
00455 m_lDirCount = 0;
00456 KFileItemList entries = d->dirLister->items();
00457 for (KFileItemListIterator it(entries); it.current(); ++it)
00458 {
00459 if ( !it.current()->isDir() )
00460 {
00461 if (!it.current()->isLink())
00462 m_lDirSize += it.current()->size();
00463 m_lFileCount++;
00464 }
00465 else
00466 m_lDirCount++;
00467 }
00468 d->dirSizeDirty = false;
00469 }
00470
00471 QString summary =
00472 KIO::itemsSummaryString(m_lFileCount + m_lDirCount,
00473 m_lFileCount,
00474 m_lDirCount,
00475 m_lDirSize,
00476 true);
00477 bool bShowsResult = false;
00478 if (m_findPart)
00479 {
00480 QVariant prop = m_findPart->property( "showsResult" );
00481 bShowsResult = prop.isValid() && prop.toBool();
00482 }
00483
00484 emit setStatusBarText( bShowsResult ? i18n("Search result: %1").arg(summary) : summary );
00485 }
00486
00487 void KonqDirPart::emitCounts( const KFileItemList & lst )
00488 {
00489 if ( lst.count() == 1 )
00490 emit setStatusBarText( ((KFileItemList)lst).first()->getStatusBarInfo() );
00491 else
00492 {
00493 long long fileSizeSum = 0;
00494 uint fileCount = 0;
00495 uint dirCount = 0;
00496
00497 for ( KFileItemListIterator it( lst ); it.current(); ++it )
00498 {
00499 if ( it.current()->isDir() )
00500 dirCount++;
00501 else
00502 {
00503 if ( !it.current()->isLink() )
00504 fileSizeSum += it.current()->size();
00505 fileCount++;
00506 }
00507 }
00508
00509 emit setStatusBarText( KIO::itemsSummaryString( fileCount + dirCount,
00510 fileCount, dirCount,
00511 fileSizeSum, true ) );
00512 }
00513 }
00514
00515 void KonqDirPart::emitCounts( const KFileItemList & lst, bool selectionChanged )
00516 {
00517 if ( lst.count() == 0 )
00518 emitTotalCount();
00519 else
00520 emitCounts( lst );
00521
00522
00523
00524
00525
00526
00527
00528
00529 if ( selectionChanged )
00530 emit m_extension->selectionInfo( lst );
00531 }
00532
00533 void KonqDirPart::emitMouseOver( const KFileItem* item )
00534 {
00535 emit m_extension->mouseOverInfo( item );
00536 }
00537
00538 void KonqDirPart::slotIconSizeToggled( bool toggleOn )
00539 {
00540
00541
00542
00543
00544
00545 if ( !toggleOn )
00546 return;
00547
00548 if ( m_paDefaultIcons->isChecked() )
00549 setIconSize(0);
00550 else if ( d->aEnormousIcons->isChecked() )
00551 setIconSize(d->findNearestIconSize(KIcon::SizeEnormous));
00552 else if ( m_paHugeIcons->isChecked() )
00553 setIconSize(d->findNearestIconSize(KIcon::SizeHuge));
00554 else if ( m_paLargeIcons->isChecked() )
00555 setIconSize(d->findNearestIconSize(KIcon::SizeLarge));
00556 else if ( m_paMediumIcons->isChecked() )
00557 setIconSize(d->findNearestIconSize(KIcon::SizeMedium));
00558 else if ( d->aSmallMediumIcons->isChecked() )
00559 setIconSize(d->findNearestIconSize(KIcon::SizeSmallMedium));
00560 else if ( m_paSmallIcons->isChecked() )
00561 setIconSize(d->findNearestIconSize(KIcon::SizeSmall));
00562 }
00563
00564 void KonqDirPart::slotIncIconSize()
00565 {
00566 int s = m_pProps->iconSize();
00567 s = s ? s : KGlobal::iconLoader()->currentSize( KIcon::Desktop );
00568 uint sizeIndex = 0;
00569 for ( uint idx = 1; idx < d->iconSize.count() ; ++idx )
00570 if (s == d->iconSize[idx]) {
00571 sizeIndex = idx;
00572 break;
00573 }
00574 if ( sizeIndex > 0 && sizeIndex < d->iconSize.count() - 1 )
00575 {
00576 setIconSize( d->iconSize[sizeIndex + 1] );
00577 }
00578 }
00579
00580 void KonqDirPart::slotDecIconSize()
00581 {
00582 int s = m_pProps->iconSize();
00583 s = s ? s : KGlobal::iconLoader()->currentSize( KIcon::Desktop );
00584 uint sizeIndex = 0;
00585 for ( uint idx = 1; idx < d->iconSize.count() ; ++idx )
00586 if (s == d->iconSize[idx]) {
00587 sizeIndex = idx;
00588 break;
00589 }
00590 if ( sizeIndex > 1 )
00591 {
00592 setIconSize( d->iconSize[sizeIndex - 1] );
00593 }
00594 }
00595
00596
00597 void KonqDirPart::newIconSize( int size )
00598 {
00599 int realSize = (size==0) ? KGlobal::iconLoader()->currentSize( KIcon::Desktop ) : size;
00600 m_paDecIconSize->setEnabled(realSize > d->iconSize[1]);
00601 m_paIncIconSize->setEnabled(realSize < d->iconSize.back());
00602
00603 m_paDefaultIcons->setChecked(size == 0);
00604 d->aEnormousIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeEnormous));
00605 m_paHugeIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeHuge));
00606 m_paLargeIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeLarge));
00607 m_paMediumIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeMedium));
00608 d->aSmallMediumIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeSmallMedium));
00609 m_paSmallIcons->setChecked(size == d->findNearestIconSize(KIcon::SizeSmall));
00610 }
00611
00612
00613 void KonqDirPart::setIconSize( int size )
00614 {
00615
00616 m_pProps->setIconSize( size );
00617 newIconSize( size );
00618 }
00619
00620 bool KonqDirPart::closeURL()
00621 {
00622
00623 return doCloseURL();
00624 }
00625
00626 bool KonqDirPart::openURL(const KURL& url)
00627 {
00628 if ( m_findPart )
00629 {
00630 kdDebug(1203) << "KonqDirPart::openURL -> emit findClosed " << this << endl;
00631 delete m_findPart;
00632 m_findPart = 0L;
00633 emit findClosed( this );
00634 }
00635
00636 m_url = url;
00637 emit aboutToOpenURL ();
00638
00639 return doOpenURL(url);
00640 }
00641
00642 void KonqDirPart::setFindPart( KParts::ReadOnlyPart * part )
00643 {
00644 assert(part);
00645 m_findPart = part;
00646 connect( m_findPart, SIGNAL( started() ),
00647 this, SLOT( slotStarted() ) );
00648 connect( m_findPart, SIGNAL( started() ),
00649 this, SLOT( slotStartAnimationSearching() ) );
00650 connect( m_findPart, SIGNAL( clear() ),
00651 this, SLOT( slotClear() ) );
00652 connect( m_findPart, SIGNAL( newItems( const KFileItemList & ) ),
00653 this, SLOT( slotNewItems( const KFileItemList & ) ) );
00654 connect( m_findPart, SIGNAL( finished() ),
00655 this, SLOT( slotCompleted() ) );
00656 connect( m_findPart, SIGNAL( finished() ),
00657 this, SLOT( slotStopAnimationSearching() ) );
00658 connect( m_findPart, SIGNAL( canceled() ),
00659 this, SLOT( slotCanceled() ) );
00660 connect( m_findPart, SIGNAL( canceled() ),
00661 this, SLOT( slotStopAnimationSearching() ) );
00662
00663 connect( m_findPart, SIGNAL( findClosed() ),
00664 this, SLOT( slotFindClosed() ) );
00665
00666 emit findOpened( this );
00667
00668
00669 m_findPart->openURL( url() );
00670 }
00671
00672 void KonqDirPart::slotFindClosed()
00673 {
00674 kdDebug(1203) << "KonqDirPart::slotFindClosed -> emit findClosed " << this << endl;
00675 delete m_findPart;
00676 m_findPart = 0L;
00677 emit findClosed( this );
00678
00679 openURL( url() );
00680 }
00681
00682 void KonqDirPart::slotIconChanged( int group )
00683 {
00684 if (group != KIcon::Desktop) return;
00685 adjustIconSizes();
00686 }
00687
00688 void KonqDirPart::slotStartAnimationSearching()
00689 {
00690 started(0);
00691 }
00692
00693 void KonqDirPart::slotStopAnimationSearching()
00694 {
00695 completed();
00696 }
00697
00698 void KonqDirPartBrowserExtension::saveState( QDataStream &stream )
00699 {
00700 m_dirPart->saveState( stream );
00701 bool hasFindPart = m_dirPart->findPart();
00702 stream << hasFindPart;
00703 assert( ! ( hasFindPart && m_dirPart->className() == "KFindPart" ) );
00704 if ( !hasFindPart )
00705 KParts::BrowserExtension::saveState( stream );
00706 else {
00707 m_dirPart->saveFindState( stream );
00708 }
00709 }
00710
00711 void KonqDirPartBrowserExtension::restoreState( QDataStream &stream )
00712 {
00713 m_dirPart->restoreState( stream );
00714 bool hasFindPart;
00715 stream >> hasFindPart;
00716 assert( ! ( hasFindPart && m_dirPart->className() == "KFindPart" ) );
00717 if ( !hasFindPart )
00718
00719 KParts::BrowserExtension::restoreState( stream );
00720 else {
00721 m_dirPart->restoreFindState( stream );
00722 }
00723 }
00724
00725
00726 void KonqDirPart::resetCount()
00727 {
00728 m_lDirSize = 0;
00729 m_lFileCount = 0;
00730 m_lDirCount = 0;
00731 d->dirSizeDirty = true;
00732 }
00733
00734 void KonqDirPart::setDirLister( KDirLister* lister )
00735 {
00736 d->dirLister = lister;
00737 }
00738
00739 #include "konq_dirpart.moc"