DirFilterPlugin::DirFilterPlugin (QObject* parent, const QVariantList &) :KParts::Plugin (parent) { m_part = qobject_cast<KParts::ReadOnlyPart*>(parent); if (m_part) { connect(m_part, SIGNAL(aboutToOpenURL()), this, SLOT(slotOpenURL())); connect(m_part, SIGNAL(completed()), this, SLOT(slotOpenURLCompleted())); connect(m_part, SIGNAL(completed(bool)), this, SLOT(slotOpenURLCompleted())); } KParts::ListingNotificationExtension* notifyExt = KParts::ListingNotificationExtension::childObject(m_part); if (notifyExt && notifyExt->supportedNotificationEventTypes() != KParts::ListingNotificationExtension::None) { m_listingExt = KParts::ListingFilterExtension::childObject(m_part); connect(notifyExt, SIGNAL(listingEvent(KParts::ListingNotificationExtension::NotificationEventType,KFileItemList)), this, SLOT(slotListingEvent(KParts::ListingNotificationExtension::NotificationEventType,KFileItemList))); m_pFilterMenu = new KActionMenu (KIcon("view-filter"), i18n("View F&ilter"), actionCollection()); actionCollection()->addAction("filterdir", m_pFilterMenu); m_pFilterMenu->setDelayed(false); m_pFilterMenu->setDisabled(true); m_pFilterMenu->setWhatsThis(i18n("Allow to filter the currently displayed items by filetype.")); connect(m_pFilterMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(slotShowPopup())); connect(m_pFilterMenu->menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotItemSelected(QAction*))); }
void KonqView::openUrl( const KUrl &url, const QString & locationBarURL, const QString & nameFilter, bool tempFile ) { kDebug() << "url=" << url << "locationBarURL=" << locationBarURL; setPartMimeType(); KParts::OpenUrlArguments args; if ( m_pPart ) args = m_pPart->arguments(); KParts::BrowserExtension *ext = browserExtension(); KParts::BrowserArguments browserArgs; if ( ext ) browserArgs = ext->browserArguments(); // Typing "Enter" again after the URL of an aborted view, triggers a reload. if ( m_bAborted && m_pPart && m_pPart->url() == url && !browserArgs.doPost()) { if ( !prepareReload( args, browserArgs, false /* not softReload */ ) ) return; m_pPart->setArguments( args ); } #ifdef DEBUG_HISTORY kDebug() << "m_bLockedLocation=" << m_bLockedLocation << "browserArgs.lockHistory()=" << browserArgs.lockHistory(); #endif if ( browserArgs.lockHistory() ) lockHistory(); if ( !m_bLockHistory ) { // Store this new URL in the history, removing any existing forward history. // We do this first so that everything is ready if a part calls completed(). createHistoryEntry(); } else m_bLockHistory = false; if ( m_pPart ) m_pPart->setProperty("nameFilter", nameFilter); if ( m_bDisableScrolling ) callExtensionMethod( "disableScrolling" ); // Set location-bar URL, except for error urls, where we know the browser component // will set back the url with the error anyway. if (url.protocol() != "error") setLocationBarURL(locationBarURL); setPageSecurity(KonqMainWindow::NotCrypted); if ( !args.reload() ) { // Save the POST data that is necessary to open this URL // (so that reload can re-post it) m_doPost = browserArgs.doPost(); m_postContentType = browserArgs.contentType(); m_postData = browserArgs.postData; // Save the referrer m_pageReferrer = args.metaData()["referrer"]; } if ( tempFile ) { // Store the path to the tempfile. Yes, we could store a bool only, // but this would be more dangerous. If anything goes wrong in the code, // we might end up deleting a real file. if ( url.isLocalFile() ) m_tempFile = url.toLocalFile(); else kWarning() << "Tempfile option is set, but URL is remote:" << url ; } aboutToOpenURL( url, args ); m_pPart->openUrl( url ); updateHistoryEntry(false /* don't save location bar URL yet */); // add pending history entry KonqHistoryManager::kself()->addPending( url, locationBarURL, QString()); #ifdef DEBUG_HISTORY kDebug() << "Current position:" << historyIndex(); #endif }