Kfind::Kfind( QWidget *parent, const char *name, const char *searchPath ) : QWidget( parent, name ) { // init IO buffer iBuffer = 0; //create tabdialog tabDialog = new KfindTabDialog(this,"dialog",searchPath); //prepare window for find results win = new KfindWindow(this,"window"); win->hide(); //and hide it firstly winsize=1; connect(win ,SIGNAL(resultSelected(bool)), this,SIGNAL(resultSelected(bool))); connect(win ,SIGNAL(statusChanged(const char *)), this,SIGNAL(statusChanged(const char *))); connect(this,SIGNAL(deleteFile()), win,SLOT(deleteFiles())); connect(this,SIGNAL(properties()), win,SLOT(fileProperties())); connect(this,SIGNAL(openFolder()), win,SLOT(openFolder())); connect(this,SIGNAL(saveResults()), win,SLOT(saveResults())); connect(this,SIGNAL(addToArchive()), win,SLOT(addToArchive())); connect(this,SIGNAL(open()), win,SLOT(openBinding())); connect(parentWidget(),SIGNAL(selectAll()), win,SLOT(selectAll())); connect(parentWidget(),SIGNAL(unselectAll()), win,SLOT(unselectAll())); connect(parentWidget(),SIGNAL(invertSelection()), win,SLOT(invertSelection())); connect(&findProcess,SIGNAL(processExited(KProcess *)), this,SLOT(processResults())); connect(&findProcess,SIGNAL(receivedStdout(KProcess *, char *, int)), this, SLOT(handleStdout(KProcess *, char *, int))) ; resize(sizeHint()); //emit haveResults(false); // we're not connectd to anything yet!? };
void KfindWindow::slotContextMenu(KListView *, QListViewItem *item, const QPoint &p) { if(!item) return; int count = selectedItems().count(); if(count == 0) { return; }; if(m_menu == 0) m_menu = new KPopupMenu(this); else m_menu->clear(); if(count == 1) { // menu = new KPopupMenu(item->text(0), this); m_menu->insertTitle(item->text(0)); m_menu->insertItem(SmallIcon("fileopen"), i18n("Menu item", "Open"), this, SLOT(openBinding())); m_menu->insertItem(SmallIcon("window_new"), i18n("Open Folder"), this, SLOT(openFolder())); m_menu->insertSeparator(); m_menu->insertItem(SmallIcon("editcopy"), i18n("Copy"), this, SLOT(copySelection())); m_menu->insertItem(SmallIcon("editdelete"), i18n("Delete"), this, SLOT(deleteFiles())); m_menu->insertSeparator(); m_menu->insertItem(i18n("Open With..."), this, SLOT(slotOpenWith())); m_menu->insertSeparator(); m_menu->insertItem(i18n("Properties"), this, SLOT(fileProperties())); } else { m_menu->insertTitle(i18n("Selected Files")); m_menu->insertItem(SmallIcon("editcopy"), i18n("Copy"), this, SLOT(copySelection())); m_menu->insertItem(SmallIcon("editdelete"), i18n("Delete"), this, SLOT(deleteFiles())); } m_menu->popup(p, 1); }
void MainWindow::createActions() { openAct = new QAction(tr("&Open"), this); openAct->setToolTip(tr("Open an image")); actionsManager->addAction(openAct, "_open", this, this, SLOT(open()), QKeySequence::Open); saveAct = new QAction(tr("&Save"), this); saveAct->setEnabled(false); actionsManager->addAction(saveAct, "_save", this, this, SLOT(save()), QKeySequence::Save); exitAct = new QAction(tr("&Exit"), this); actionsManager->addAction(exitAct, "_exit", this, this, SLOT(close()), QKeySequence::Quit); filePropertiesAct = new QAction(tr("Properties"), this); filePropertiesAct->setEnabled(false); actionsManager->addAction(filePropertiesAct, "_fileProperties", this, this, SLOT(fileProperties()), QKeySequence("Ctrl+.")); zoomInAct = new QAction(tr("Zoom In"), this); zoomInAct->setEnabled(false); actionsManager->addAction(zoomInAct, "_zoomIn", this, this, SLOT(zoomIn()), QKeySequence("+")); zoomOutAct = new QAction(tr("Zoom Out"), this); zoomOutAct->setEnabled(false); actionsManager->addAction(zoomOutAct, "_zoomOut", this, this, SLOT(zoomOut()), QKeySequence("-")); normalSizeAct = new QAction(tr("Normal Size"), this); normalSizeAct->setEnabled(false); actionsManager->addAction(normalSizeAct, "_normalSize", this, this, SLOT(normalSize()), QKeySequence("1")); adjustSizeAct = new QAction(tr("Best Fit"), this); adjustSizeAct->setEnabled(false); adjustSizeAct->setCheckable(true); actionsManager->addAction(adjustSizeAct, "_adjustSize", this, this, SLOT(adjustSizeSlot()), QKeySequence("0")); rotateRightAct = new QAction(tr("Rotate to right"), this); rotateRightAct->setToolTip(tr("Rotate image in the clockwise clock")); rotateRightAct->setEnabled(false); actionsManager->addAction(rotateRightAct, "_rotateRight", this, this, SLOT(rotateRight())); rotateLeftAct = new QAction(tr("Rotate to Left"), this); rotateLeftAct->setToolTip(tr("Rotate image counter-clockwise to clockwise")); rotateLeftAct->setEnabled(false); actionsManager->addAction(rotateLeftAct, "_rotateLeft", this, this, SLOT(rotateLeft())); flipVerticallyAct = new QAction(tr("Flip vertically"), this); flipVerticallyAct->setToolTip(tr("Turns vertically the image")); flipVerticallyAct->setEnabled(false); actionsManager->addAction(flipVerticallyAct, "_flipVertically", this, this, SLOT(flipVertically())); flipHorizontallyAct = new QAction(tr("Flip horizontally"), this); flipHorizontallyAct->setToolTip(tr("Reflects the image")); flipHorizontallyAct->setEnabled(false); actionsManager->addAction(flipHorizontallyAct, "_flipHorizontally", this, this, SLOT(flipHorizontally())); aboutAct = new QAction(tr("A&bout"), this); actionsManager->addAction(aboutAct, "_about", this, this, SLOT(about()), QKeySequence::HelpContents); nextAct = new QAction(tr("Ne&xt"), this); nextAct->setStatusTip(tr("Loads next image")); nextAct->setEnabled(false); actionsManager->addAction(nextAct, "_next", this, this, SLOT(next()), Qt::Key_Right); goFirstAct = new QAction(tr("Go to the first"), this); goFirstAct->setStatusTip(tr("Loads the first image in the folder")); goFirstAct->setEnabled(false); actionsManager->addAction(goFirstAct, "_goFirst", this, this, SLOT(goFirst()), Qt::Key_Home); prevAct = new QAction(tr("Pre&vious"), this); prevAct->setStatusTip(tr("Loads previous image")); prevAct->setEnabled(false); actionsManager->addAction(prevAct, "_previous", this, this, SLOT(previous()), Qt::Key_Left); goLastAct = new QAction(tr("Go to the last"), this); goLastAct->setStatusTip(tr("Loads the last image in the folder")); goLastAct->setEnabled(false); actionsManager->addAction(goLastAct, "_goLast", this, this, SLOT(goLast()), Qt::Key_End); openDirAct = new QAction(tr("Open &Folder"), this); openDirAct->setStatusTip("Open a folder to explore images inside it"); actionsManager->addAction(openDirAct, "_openFolder", this, this, SLOT(openDir()), QKeySequence("Ctrl+Shift+O")); showMenuBarAct = new QAction(tr("Show Menu Bar"), this); showMenuBarAct->setCheckable(true); actionsManager->addAction(showMenuBarAct, "_showMenuBar", this, this, SLOT(showMenuBar()), QKeySequence("Ctrl+M")); configAct = new QAction(tr("Configuration"), this); configAct->setEnabled(true); actionsManager->addAction(configAct, "_configuration", this, this, SLOT(configureProgram()), QKeySequence("Ctrl+C")); deleteRecentFilesAct = new QAction(tr("Delete list"), this); deleteRecentFilesAct->setIcon(QIcon::fromTheme("edit-clear")); connect(deleteRecentFilesAct, SIGNAL(triggered()), this, SLOT(deleteRecentFiles())); printAct = new QAction(tr("Print"), this); printAct->setEnabled(false); actionsManager->addAction(printAct, "_print", this, this, SLOT(print()), QKeySequence::Print); deleteFileAct = new QAction(tr("Delete"), this); deleteFileAct->setEnabled(false); deleteFileAct->setToolTip(tr("This deletes completly the file from the disk, doesn't move it to the trash")); actionsManager->addAction(deleteFileAct, "_deleteFile", this, this, SLOT(deleteFileSlot()), QKeySequence::Delete); moveToAct = new QAction(tr("Move to..."), this); moveToAct->setEnabled(false); actionsManager->addAction(moveToAct, "_moveTo", this, this, SLOT(moveToSlot())); goToAct = new QAction(tr("Go to"), this); goToAct->setEnabled(false); actionsManager->addAction(goToAct, "_goTo", this, this, SLOT(goToSlot()), QKeySequence("Ctrl+J")); configureToolBarAct = new QAction(tr("Configure toolbar"), this); actionsManager->addAction(configureToolBarAct, "_configureToolBar", this, this, SLOT(configureToolBarSlot())); //set the icons, becouse QIcon::name() was included in Qt4.7 actionsManager->setActionIcon("_about", "help-about"); actionsManager->setActionIcon("_adjustSize", "zoom-fit-best"); actionsManager->setActionIcon("_configuration", "configure"); actionsManager->setActionIcon("_deleteFile", "edit-delete"); actionsManager->setActionIcon("_exit", "application-exit"); actionsManager->setActionIcon("_fileProperties", "document-properties"); actionsManager->setActionIcon("_flipHorizontally", "object-flip-horizontal"); actionsManager->setActionIcon("_flipVertically", "object-flip-vertical"); actionsManager->setActionIcon("_goFirst", "go-first"); actionsManager->setActionIcon("_goLast", "go-last"); actionsManager->setActionIcon("_goTo", "go-jump"); actionsManager->setActionIcon("_moveTo", "none"); actionsManager->setActionIcon("_next", "go-next"); actionsManager->setActionIcon("_normalSize", "zoom-original"); actionsManager->setActionIcon("_open", "document-open"); actionsManager->setActionIcon("_openFolder", "folder-open"); actionsManager->setActionIcon("_previous", "go-previous"); actionsManager->setActionIcon("_print", "document-print"); actionsManager->setActionIcon("_rotateLeft", "object-rotate-left"); actionsManager->setActionIcon("_rotateRight", "object-rotate-right"); actionsManager->setActionIcon("_save", "document-save"); actionsManager->setActionIcon("_showMenuBar", "show-menu"); actionsManager->setActionIcon("_showToolBar", "configure-toolbars"); actionsManager->setActionIcon("_tbMovable", "configure-toolbars"); actionsManager->setActionIcon("_configureToolBar", "configure-toolbars"); actionsManager->setActionIcon("_zoomIn", "zoom-in"); actionsManager->setActionIcon("_zoomOut", "zoom-out"); }
//Browser Functions void DirWidget::OpenContextMenu(){ //First generate the context menu based on the selection QStringList sel = currentSelection(); contextMenu->clear(); if(!sel.isEmpty()){ contextMenu->addAction(LXDG::findIcon("run-build-file",""), tr("Open"), this, SLOT(on_tool_act_run_clicked()) ); contextMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Open With..."), this, SLOT(on_tool_act_runwith_clicked()) ); contextMenu->addAction(LXDG::findIcon("edit-rename",""), tr("Rename"), this, SLOT(on_tool_act_rename_clicked()) )->setEnabled(canmodify); contextMenu->addAction(LXDG::findIcon("document-encrypted",""), tr("View Checksums"), this, SLOT(fileCheckSums()) ); contextMenu->addSeparator(); } //Now add the general selection options contextMenu->addAction(LXDG::findIcon("edit-cut",""), tr("Cut Selection"), this, SLOT(on_tool_act_cut_clicked()) )->setEnabled(canmodify && !sel.isEmpty()); contextMenu->addAction(LXDG::findIcon("edit-copy",""), tr("Copy Selection"), this, SLOT(on_tool_act_copy_clicked()) )->setEnabled(!sel.isEmpty()); contextMenu->addAction(LXDG::findIcon("edit-paste",""), tr("Paste"), this, SLOT(on_tool_act_paste_clicked()) )->setEnabled(QApplication::clipboard()->mimeData()->hasFormat("x-special/lumina-copied-files") && canmodify); contextMenu->addSeparator(); contextMenu->addAction(LXDG::findIcon("edit-delete",""), tr("Delete Selection"), this, SLOT(on_tool_act_rm_clicked()) )->setEnabled(canmodify&&!sel.isEmpty()); if(LUtils::isValidBinary("lumina-fileinfo")){ contextMenu->addSeparator(); contextMenu->addAction(LXDG::findIcon("edit-find-replace",""), tr("File Properties"), this, SLOT(fileProperties()) )->setEnabled(!sel.isEmpty()); } contextMenu->addSeparator(); contextMenu->addAction(LXDG::findIcon("system-search",""), tr("Open Terminal here"), this, SLOT(openTerminal())); //Now open the menu at the current cursor location contextMenu->popup(QCursor::pos()); }