bool LiteFindPlugin::load(LiteApi::IApplication *app) { m_liteApp = app; QLayout *layout = m_liteApp->editorManager()->widget()->layout(); if (!layout) { return false; } QMenu *menu = m_liteApp->actionManager()->loadMenu(ID_MENU_FIND); if (!menu) { return false; } m_findEditor = new FindEditor(m_liteApp,this); m_findEditor->widget()->hide(); layout->addWidget(m_findEditor->widget()); LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Find"); m_findAct = new QAction(tr("Find"),this); actionContext->regAction(m_findAct,"Find",QKeySequence::Find); m_findNextAct = new QAction(tr("Find Next"),this); actionContext->regAction(m_findNextAct,"FindNext",QKeySequence::FindNext); m_findPrevAct = new QAction(tr("Find Previous"),this); actionContext->regAction(m_findPrevAct,"FindPrevious",QKeySequence::FindPrevious); m_replaceAct = new QAction(tr("Replace"),this); #ifdef Q_OS_MAC actionContext->regAction(m_replaceAct,"Replace","ALT+CTRL+F"); #else actionContext->regAction(m_replaceAct,"Replace",QKeySequence::Replace); #endif m_fileSearchAct = new QAction(tr("File Search"),this); actionContext->regAction(m_fileSearchAct,"FileSearch","Ctrl+Shift+F"); menu->addAction(m_findAct); menu->addAction(m_findNextAct); menu->addAction(m_findPrevAct); menu->addSeparator(); menu->addAction(m_replaceAct); menu->addSeparator(); menu->addAction(m_fileSearchAct); connect(m_findAct,SIGNAL(triggered()),this,SLOT(find())); connect(m_findNextAct,SIGNAL(triggered()),m_findEditor,SLOT(findNext())); connect(m_findPrevAct,SIGNAL(triggered()),m_findEditor,SLOT(findPrev())); connect(m_replaceAct,SIGNAL(triggered()),this,SLOT(replace())); connect(m_liteApp,SIGNAL(key_escape()),this,SLOT(hideFind())); FileSearchManager *manager = new FileSearchManager(m_liteApp,this); FileSearch *fileSearch = new FileSearch(m_liteApp,manager); manager->addFileSearch(fileSearch); connect(m_fileSearchAct,SIGNAL(triggered()),manager,SLOT(newSearch())); return true; }
void TailView::setActive(bool active) { // No need to perform any action if we're not changing state if (active == m_isActive) { return; } m_isActive = active; m_hasUnviewedChanges = m_isActive ? false : m_hasUnviewedChanges; SearchInfo & si = SearchInfo::instance(); if (active) { connect(&si, SIGNAL(newSearch()), SLOT(newSearch())); } else { disconnect(&si, SIGNAL(newSearch()), this, SLOT(newSearch())); } }
SearchDialog::SearchDialog() { SET_WNDPROC("search") setIcon(Pict("find")); setButtonsPict(this); setCaption(i18n("Search")); m_current = NULL; m_currentResult = NULL; m_bAdd = true; m_id = 0; m_result_id = 0; m_active = NULL; m_search = new SearchBase(this); m_update = new QTimer(this); connect(m_update, SIGNAL(timeout()), this, SLOT(update())); setCentralWidget(m_search); m_status = statusBar(); m_result = NULL; setAdd(false); m_search->btnOptions->setIconSet(Icon("1downarrow")); m_search->btnAdd->setIconSet(Icon("add")); m_search->btnNew->setIconSet(Icon("new")); connect(m_search->wndCondition, SIGNAL(aboutToShow(QWidget*)), this, SLOT(aboutToShow(QWidget*))); connect(m_search->wndResult, SIGNAL(aboutToShow(QWidget*)), this, SLOT(resultShow(QWidget*))); fillClients(); connect(m_search->cmbClients, SIGNAL(activated(int)), this, SLOT(clientActivated(int))); m_result = new ListView(m_search->wndResult); m_result->addColumn(i18n("Results")); m_result->setShowSortIndicator(true); m_result->setExpandingColumn(0); m_result->setFrameShadow(QFrame::Sunken); m_result->setLineWidth(1); addResult(m_result); showResult(NULL); aboutToShow(m_search->wndCondition->visibleWidget()); connect(m_search->btnSearch, SIGNAL(clicked()), this, SLOT(searchClick())); m_search->cmbClients->setFocus(); connect(m_search->btnOptions, SIGNAL(clicked()), this, SLOT(optionsClick())); connect(m_search->btnAdd, SIGNAL(clicked()), this, SLOT(addClick())); m_search->btnOptions->setEnabled(false); m_search->btnAdd->setEnabled(false); connect(m_result, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(m_result, SIGNAL(dragStart()), this, SLOT(dragStart())); connect(m_search->btnNew, SIGNAL(clicked()), this, SLOT(newSearch())); m_result->setMenu(MenuSearchItem); resultShow(m_result); }
void DiskUsageViewer::openUrl(QUrl url) { if (diskUsage == 0) { diskUsage = new DiskUsage("DiskUsageViewer", this); connect(diskUsage, SIGNAL(enteringDirectory(Directory *)), this, SLOT(slotUpdateStatus())); connect(diskUsage, SIGNAL(status(QString)), this, SLOT(slotUpdateStatus(QString))); connect(diskUsage, SIGNAL(newSearch()), this, SLOT(slotNewSearch())); layout->addWidget(diskUsage, 0, 0); this->show(); diskUsage->show(); KConfigGroup group(krConfig, "DiskUsageViewer"); int view = group.readEntry("View", VIEW_FILELIGHT); if (view < VIEW_LINES || view > VIEW_FILELIGHT) view = VIEW_FILELIGHT; diskUsage->setView(view); }
SearchSideBarWidget::SearchSideBarWidget(QWidget* parent, SearchModel* searchModel, SearchModificationHelper* searchModeificationHelper) : SidebarWidget(parent), d(new SearchSideBarWidgetPriv) { setObjectName("Search Sidebar"); d->searchModel = searchModel; QVBoxLayout* layout = new QVBoxLayout(this); d->searchTabHeader = new SearchTabHeader(this); d->searchTreeView = new NormalSearchTreeView(this, searchModel, searchModeificationHelper); d->searchTreeView->setConfigGroup(getConfigGroup()); d->searchTreeView->filteredModel()->listNormalSearches(); d->searchTreeView->filteredModel()->setListTemporarySearches(true); d->searchTreeView->setAlbumManagerCurrentAlbum(true); d->searchSearchBar = new SearchTextBar(this, "DigikamViewSearchSearchBar"); d->searchSearchBar->setModel(d->searchTreeView->filteredModel(), AbstractAlbumModel::AlbumIdRole, AbstractAlbumModel::AlbumTitleRole); d->searchSearchBar->setFilterModel(d->searchTreeView->albumFilterModel()); layout->addWidget(d->searchTabHeader); layout->addWidget(d->searchTreeView); layout->setStretchFactor(d->searchTreeView, 1); layout->addWidget(d->searchSearchBar); connect(d->searchTreeView, SIGNAL(newSearch()), d->searchTabHeader, SLOT(newAdvancedSearch())); connect(d->searchTreeView, SIGNAL(editSearch(SAlbum*)), d->searchTabHeader, SLOT(editSearch(SAlbum*))); connect(d->searchTreeView, SIGNAL(currentAlbumChanged(Album*)), d->searchTabHeader, SLOT(selectedSearchChanged(Album*))); connect(d->searchTabHeader, SIGNAL(searchShallBeSelected(SAlbum*)), d->searchTreeView, SLOT(setCurrentAlbum(SAlbum*))); }
DiskUsageGUI::DiskUsageGUI(QUrl openDir, QWidget* parent) : QDialog(parent), exitAtFailure(true) { setWindowTitle(i18n("Krusader::Disk Usage")); baseDirectory = openDir; if (!newSearch()) return; QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QGridLayout *duGrid = new QGridLayout(); duGrid->setSpacing(6); duGrid->setContentsMargins(11, 11, 11, 11); QWidget *duTools = new QWidget(this); QHBoxLayout *duHBox = new QHBoxLayout(duTools); duHBox->setContentsMargins(0, 0, 0, 0); duTools->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); btnNewSearch = new QToolButton(duTools); btnNewSearch->setIcon(QIcon(krLoader->loadIcon("document-open", KIconLoader::Desktop))); duHBox->addWidget(btnNewSearch); btnNewSearch->setToolTip(i18n("Start new disk usage search")); btnRefresh = new QToolButton(duTools); btnRefresh->setIcon(QIcon(krLoader->loadIcon("view-refresh", KIconLoader::Desktop))); duHBox->addWidget(btnRefresh); btnRefresh->setToolTip(i18n("Refresh")); btnDirUp = new QToolButton(duTools); btnDirUp->setIcon(QIcon(krLoader->loadIcon("go-up", KIconLoader::Desktop))); duHBox->addWidget(btnDirUp); btnDirUp->setToolTip(i18n("Parent folder")); QWidget * separatorWidget = new QWidget(duTools); separatorWidget->setMinimumWidth(10); duHBox->addWidget(separatorWidget); btnLines = new QToolButton(duTools); btnLines->setIcon(QIcon(krLoader->loadIcon("view-list-details", KIconLoader::Desktop))); btnLines->setCheckable(true); duHBox->addWidget(btnLines); btnLines->setToolTip(i18n("Line view")); btnDetailed = new QToolButton(duTools); btnDetailed->setIcon(QIcon(krLoader->loadIcon("view-list-tree", KIconLoader::Desktop))); btnDetailed->setCheckable(true); duHBox->addWidget(btnDetailed); btnDetailed->setToolTip(i18n("Detailed view")); btnFilelight = new QToolButton(duTools); btnFilelight->setIcon(QIcon(krLoader->loadIcon("kr_diskusage", KIconLoader::Desktop))); btnFilelight->setCheckable(true); duHBox->addWidget(btnFilelight); btnFilelight->setToolTip(i18n("Filelight view")); QWidget *spacerWidget = new QWidget(duTools); duHBox->addWidget(spacerWidget); QHBoxLayout *hboxlayout = new QHBoxLayout(spacerWidget); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed); hboxlayout->addItem(spacer); duGrid->addWidget(duTools, 0, 0); diskUsage = new DiskUsage("DiskUsage", this); duGrid->addWidget(diskUsage, 1, 0); status = new KSqueezedTextLabel(this); duGrid->addWidget(status, 2, 0); mainLayout->addLayout(duGrid); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); mainLayout->addWidget(buttonBox); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(diskUsage, SIGNAL(status(QString)), this, SLOT(setStatus(QString))); connect(diskUsage, SIGNAL(viewChanged(int)), this, SLOT(slotViewChanged(int))); connect(diskUsage, SIGNAL(newSearch()), this, SLOT(newSearch())); connect(diskUsage, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); connect(btnNewSearch, SIGNAL(clicked()), this, SLOT(newSearch())); connect(btnRefresh, SIGNAL(clicked()), this, SLOT(loadUsageInfo())); connect(btnDirUp, SIGNAL(clicked()), diskUsage, SLOT(dirUp())); connect(btnLines, SIGNAL(clicked()), this, SLOT(selectLinesView())); connect(btnDetailed, SIGNAL(clicked()), this, SLOT(selectListView())); connect(btnFilelight, SIGNAL(clicked()), this, SLOT(selectFilelightView())); KConfigGroup group(krConfig, "DiskUsage"); int view = group.readEntry("View", VIEW_LINES); if (view < VIEW_LINES || view > VIEW_FILELIGHT) view = VIEW_LINES; diskUsage->setView(view); sizeX = group.readEntry("Window Width", QFontMetrics(font()).width("W") * 70); sizeY = group.readEntry("Window Height", QFontMetrics(font()).height() * 25); resize(sizeX, sizeY); if (group.readEntry("Window Maximized", false)) showMaximized(); else show(); exec(); }
void KfindTop::toolBarInit() { KIconLoader *loader = kapp->getIconLoader(); QPixmap icon; icon = loader->loadIcon("search.xpm"); _toolBar->insertButton( icon, 0, SIGNAL(clicked()), _kfind, SLOT(startSearch()), TRUE, i18n("Start Search")); icon = loader->loadIcon("reload.xpm"); _toolBar->insertButton( icon, 1, SIGNAL(clicked()), _kfind, SLOT(newSearch()), TRUE, i18n("New Search")); icon = loader->loadIcon("stop.xpm"); _toolBar->insertButton( icon, 2, SIGNAL(clicked()), _kfind, SLOT(stopSearch()), FALSE, i18n("Stop Search")); _toolBar->insertSeparator(); icon = loader->loadIcon("openfile.xpm"); _toolBar->insertButton( icon, 3,SIGNAL(clicked()), _kfind,SIGNAL(open()), FALSE, i18n("Open")); icon = loader->loadIcon("archive.xpm"); _toolBar->insertButton( icon, 4,SIGNAL(clicked()), _kfind,SIGNAL(addToArchive()), FALSE, i18n("Add to archive")); icon = loader->loadIcon("delete.xpm"); _toolBar->insertButton( icon, 5,SIGNAL(clicked()), _kfind,SIGNAL(deleteFile()), FALSE, i18n("Delete")); icon = loader->loadIcon("info.xpm"); _toolBar->insertButton( icon, 6,SIGNAL(clicked()), _kfind,SIGNAL(properties()), FALSE, i18n("Properties")); icon = loader->loadIcon("fileopen.xpm"); _toolBar->insertButton( icon, 7,SIGNAL(clicked()), _kfind,SIGNAL(openFolder()), FALSE, i18n("Open Containing Folder")); icon = loader->loadIcon("save.xpm"); _toolBar->insertButton( icon, 8,SIGNAL(clicked()), _kfind,SIGNAL(saveResults()), FALSE, i18n("Save Search Results")); _toolBar->insertSeparator(); icon = loader->loadIcon("contents.xpm"); _toolBar->insertButton( icon, 9, SIGNAL( clicked() ), kapp, SLOT( appHelpActivated() ), TRUE, i18n("Help")); icon = loader->loadIcon("exit.xpm"); _toolBar->insertButton( icon, 10, SIGNAL( clicked() ), KApplication::getKApplication(), SLOT( quit() ), TRUE, i18n("Quit")); };
void Display::_itemChosen(QListBoxItem* item) { const char* word = item->text(); emit newSearch(word); }