KateFileBrowser::KateFileBrowser(Kate::MainWindow *mainWindow, QWidget * parent, const char * name) : KVBox (parent) , m_mainWindow(mainWindow) { setObjectName(name); m_toolbar = new KToolBar(this); m_toolbar->setMovable(false); m_toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); m_toolbar->setContextMenuPolicy(Qt::NoContextMenu); // includes some actions, but not hooked into the shortcut dialog atm m_actionCollection = new KActionCollection(this); m_actionCollection->addAssociatedWidget(this); KFilePlacesModel* model = new KFilePlacesModel(this); m_urlNavigator = new KUrlNavigator(model, KUrl(QDir::homePath()), this); connect(m_urlNavigator, SIGNAL(urlChanged(KUrl)), SLOT(updateDirOperator(KUrl))); m_dirOperator = new KDirOperator(KUrl(), this); m_dirOperator->setView(KFile::/* Simple */Detail); m_dirOperator->view()->setSelectionMode(QAbstractItemView::ExtendedSelection); m_dirOperator->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); // Mime filter for the KDirOperator QStringList filter; filter << "text/plain" << "text/html" << "inode/directory"; m_dirOperator->setNewFileMenuSupportedMimeTypes(filter); setFocusProxy(m_dirOperator); connect(m_dirOperator, SIGNAL(viewChanged(QAbstractItemView*)), this, SLOT(selectorViewChanged(QAbstractItemView*))); connect(m_urlNavigator, SIGNAL(returnPressed()), m_dirOperator, SLOT(setFocus())); // now all actions exist in dir operator and we can use them in the toolbar setupActions(); setupToolbar(); KHBox* filterBox = new KHBox(this); QLabel* filterLabel = new QLabel(i18n("Filter:"), filterBox); m_filter = new KHistoryComboBox(true, filterBox); filterLabel->setBuddy(m_filter); m_filter->setMaxCount(10); m_filter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); connect(m_filter, SIGNAL(editTextChanged(QString)), SLOT(slotFilterChange(QString))); connect(m_filter, SIGNAL(returnPressed(QString)), m_filter, SLOT(addToHistory(QString))); connect(m_filter, SIGNAL(returnPressed(QString)), m_dirOperator, SLOT(setFocus())); connect(m_dirOperator, SIGNAL(urlEntered(KUrl)), this, SLOT(updateUrlNavigator(KUrl))); // Connect the bookmark handler connect(m_bookmarkHandler, SIGNAL(openUrl(QString)), this, SLOT(setDir(QString))); m_filter->setWhatsThis(i18n("Enter a name filter to limit which files are displayed.")); connect(m_dirOperator, SIGNAL(fileSelected(KFileItem)), this, SLOT(fileSelected(KFileItem))); connect(m_mainWindow, SIGNAL(viewChanged()), this, SLOT(autoSyncFolder())); }
K3b::DirView::DirView( K3b::FileTreeView* treeView, QWidget* parent ) : QWidget(parent), d( new Private ) { d->fileTreeView = treeView; d->bViewDiskInfo = false; d->contextMediaInfoRequested = false; QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); if( !d->fileTreeView ) { d->mainSplitter = new QSplitter( this ); d->fileTreeView = new K3b::FileTreeView( d->mainSplitter ); d->viewStack = new QStackedWidget( d->mainSplitter ); layout->addWidget( d->mainSplitter ); } else { d->viewStack = new QStackedWidget( this ); d->mainSplitter = 0; layout->addWidget( d->viewStack ); } d->fileView = new K3b::FileView( d->viewStack ); d->viewStack->addWidget( d->fileView ); d->cdView = new K3b::AudioCdView( d->viewStack ); d->viewStack->addWidget( d->cdView ); d->videoView = new K3b::VideoCdView( d->viewStack ); d->viewStack->addWidget( d->videoView ); d->infoView = new K3b::DiskInfoView( d->viewStack ); d->viewStack->addWidget( d->infoView ); #ifdef ENABLE_DVD_RIPPING d->movieView = new K3b::VideoDVDRippingView( d->viewStack ); d->viewStack->addWidget( d->movieView ); #endif d->setCurrentView( d->fileView ); // d->fileTreeView->setCurrentDevice( k3bappcore->appDeviceManager()->currentDevice() ); if( d->mainSplitter ) { // split QList<int> sizes = d->mainSplitter->sizes(); int all = sizes[0] + sizes[1]; sizes[1] = all*2/3; sizes[0] = all - sizes[1]; d->mainSplitter->setSizes( sizes ); } connect( d->fileTreeView, SIGNAL(activated(QUrl)), this, SLOT(slotDirActivated(QUrl)) ); connect( d->fileTreeView, SIGNAL(activated(K3b::Device::Device*)), this, SLOT(showDevice(K3b::Device::Device*)) ); connect( d->fileTreeView, SIGNAL(activated(K3b::Device::Device*)), this, SIGNAL(deviceSelected(K3b::Device::Device*)) ); connect( d->fileView, SIGNAL(urlEntered(QUrl)), d->fileTreeView, SLOT(setSelectedUrl(QUrl)) ); connect( d->fileView, SIGNAL(urlEntered(QUrl)), this, SIGNAL(urlEntered(QUrl)) ); connect( k3bappcore->appDeviceManager(), SIGNAL(mountFinished(QString)), this, SLOT(slotMountFinished(QString)) ); connect( k3bappcore->appDeviceManager(), SIGNAL(unmountFinished(bool)), this, SLOT(slotUnmountFinished(bool)) ); }