FSStatus FSOpenDirAsync(FSClient *client, FSCmdBlock *block, const char *path, be_val<FSDirectoryHandle> *handle, uint32_t flags, FSAsyncData *asyncData) { auto pathLength = strlen(path); if (pathLength >= FSCmdBlock::MaxPathLength) { return FSStatus::FatalError; } std::memcpy(block->path, path, pathLength); block->path[pathLength] = 0; internal::queueFsWork(client, block, asyncData, [=]() { auto fs = kernel::getFileSystem(); auto dir = fs->openFolder(coreinit::internal::translatePath(block->path)); if (!dir) { return FSStatus::NotFound; } *handle = client->addOpenDirectory(dir); return FSStatus::OK; }); return FSStatus::OK; }
IqAmeMainWindow::IqAmeMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::IQAMEMainWindow), m_logDialog(new IqAmeLogDialog(this)) { ui->setupUi(this); ui->layerTreeView->setModel(IqAmeApplication::aeroMapModel()); connect(ui->layerTreeView, &IqAmeMapModelTreeView::pointsClicked, this, &IqAmeMainWindow::showPoints); connect(ui->layerTreeView, &IqAmeMapModelTreeView::layerClicked, this, &IqAmeMainWindow::showLayer); ui->pointTableWidget->setModel(IqAmeApplication::aeroMapModel()->pointsModel()); #if QT_VERSION >= 0x050000 ui->layerTreeView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); ui->layerTreeView->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); ui->layerTreeView->header()->setSectionResizeMode(2, QHeaderView::Stretch); #else ui->layerTreeView->header()->setResizeMode(0, QHeaderView::ResizeToContents); ui->layerTreeView->header()->setResizeMode(1, QHeaderView::ResizeToContents); ui->layerTreeView->header()->setResizeMode(2, QHeaderView::Stretch); #endif connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openFolder())); connect(ui->actionLogs, SIGNAL(triggered()), this, SLOT(showLogs())); connect(ui->actionAntialiasing, &QAction::triggered, this, &IqAmeMainWindow::updateRenderhints); connect(ui->actionTextAntialiasing, &QAction::triggered, this, &IqAmeMainWindow::updateRenderhints); connect(ui->actionSmoothPixmapTransform, &QAction::triggered, this, &IqAmeMainWindow::updateRenderhints); connect(ui->actionHighQualityAntialiasing, &QAction::triggered, this, &IqAmeMainWindow::updateRenderhints); ui->editorWidget->hide(); ui->pointTableWidget->show(); }
QMenu* GuiTools::createProblemPopupMenu(ProjectBase* project, QWidget* mainWindow, const QPoint & iPoint,Problem* selectedProblem,int numProblem) { QMenu *menu = new QMenu(); //Open folder //Open folder QAction *openFolderAct = new QAction("Open folder",menu); connect(openFolderAct,SIGNAL(triggered()),selectedProblem,SLOT(openFolder())); QIcon icon; icon.addPixmap(QPixmap(QString::fromUtf8(":/icons/folder")), QIcon::Normal, QIcon::Off); openFolderAct->setIcon(icon); //openFolderAct->setIconSize(QSize(20, 20)); menu->addAction(openFolderAct); //Rename problem QAction *renameAct = new QAction("Rename problem...",menu); renameAct->setData(numProblem); connect(renameAct,SIGNAL(triggered()),mainWindow,SLOT(renameProblem())); menu->addAction(renameAct); //Remove problem QAction *removeAct = new QAction("Remove problem",menu); removeAct->setData(numProblem); connect(removeAct,SIGNAL(triggered()),mainWindow,SLOT(removeProblem())); QIcon iconRem; iconRem.addPixmap(QPixmap(QString::fromUtf8(":/icons/Remove")), QIcon::Normal, QIcon::Off); removeAct->setIcon(iconRem); menu->addAction(removeAct); return menu; }
bool QtFileIconView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break; case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break; case 2: newDirectory(); break; case 3: currentDir(); break; case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break; case 6: viewLarge(); break; case 7: viewSmall(); break; case 8: viewBottom(); break; case 9: viewRight(); break; case 10: flowEast(); break; case 11: flowSouth(); break; case 12: itemTextTruncate(); break; case 13: itemTextWordWrap(); break; case 14: sortAscending(); break; case 15: sortDescending(); break; case 16: arrangeItemsInGrid(); break; case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 18: openFolder(); break; default: return QIconView::qt_invoke( _id, _o ); } return TRUE; }
Frame::Frame(QWidget *parent) : QFrame(parent) { this->resize(Config::FrameWidth, Config::FrameHeight); this->setMinimumSize(Config::FrameWidth, Config::FrameHeight); this->setMaximumSize(Config::FrameWidth, Config::FrameHeight); this->setWindowFlags(Qt::FramelessWindowHint); this->setStyleSheet(Config::FrameStyleSheet); _titlebar = new TitleBar(this); _toolbar = new ToolBar(this); _panel = new PanelWin(this); _statebar = new StateBar(this); _layout = new QVBoxLayout(this); _layout->setSpacing(0); _layout->setMargin(0); _layout->addWidget(_titlebar); _layout->addWidget(_toolbar); _layout->addWidget(_panel); _layout->addWidget(_statebar); connect(_titlebar->_btnMin, SIGNAL(clicked()), this, SLOT(minwin())); connect(_titlebar->_btnClose, SIGNAL(clicked()), this, SLOT(closewin())); connect(_toolbar->_btnKey, SIGNAL(clicked()), _panel, SLOT(selectKey())); connect(_toolbar->_btnCust, SIGNAL(clicked()), _panel, SLOT(selectCust())); connect(_panel->_btnExtractStart, SIGNAL(clicked()), this, SLOT(extractStart())); connect(_panel->_btnExtractCancel, SIGNAL(clicked()), this, SLOT(extractCancel())); connect(_panel->_btnSearchBrowse, SIGNAL(clicked()), this, SLOT(openFolder())); connect(_panel->_btnSearchStart, SIGNAL(clicked()), this, SLOT(searchStart())); connect(_panel->_btnSearchCancel, SIGNAL(clicked()), this, SLOT(searchCancel())); connect(_panel->_btnClearLogs, SIGNAL(clicked()), this, SLOT(clearLogs())); connect(_panel->_btnBackupBrowse, SIGNAL(clicked()), this, SLOT(openFolder())); connect(_panel->_btnBackupStart, SIGNAL(clicked()), this, SLOT(backupStart())); connect(_panel->_btnBackupCancel, SIGNAL(clicked()), this, SLOT(backupCancel())); _panel->_btnSearchCancel->setEnabled(false); _panel->_btnBackupCancel->setEnabled(false); _panel->_btnClearLogs->setEnabled(false); }
/** * @brief ConcertFilesWidget::ConcertFilesWidget * @param parent */ ConcertFilesWidget::ConcertFilesWidget(QWidget *parent) : QWidget(parent), ui(new Ui::ConcertFilesWidget) { m_instance = this; ui->setupUi(this); ui->statusLabel->setText(tr("%n concerts", "", 0)); #ifdef Q_OS_MAC QFont font = ui->files->font(); font.setPointSize(font.pointSize()-2); ui->files->setFont(font); #endif #ifdef Q_OS_WIN32 ui->verticalLayout->setContentsMargins(0, 0, 0, 1); #endif m_mouseIsIn = false; m_alphaList = new AlphabeticalList(this); m_lastConcert = 0; m_concertProxyModel = new ConcertProxyModel(this); m_concertProxyModel->setSourceModel(Manager::instance()->concertModel()); m_concertProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_concertProxyModel->setDynamicSortFilter(true); ui->files->setModel(m_concertProxyModel); ui->files->sortByColumn(0); QAction *actionMarkAsWatched = new QAction(tr("Mark as watched"), this); QAction *actionMarkAsUnwatched = new QAction(tr("Mark as unwatched"), this); QAction *actionLoadStreamDetails = new QAction(tr("Load Stream Details"), this); QAction *actionMarkForSync = new QAction(tr("Add to Synchronization Queue"), this); QAction *actionUnmarkForSync = new QAction(tr("Remove from Synchronization Queue"), this); QAction *actionOpenFolder = new QAction(tr("Open Concert Folder"), this); m_contextMenu = new QMenu(ui->files); m_contextMenu->addAction(actionMarkAsWatched); m_contextMenu->addAction(actionMarkAsUnwatched); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionLoadStreamDetails); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionMarkForSync); m_contextMenu->addAction(actionUnmarkForSync); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionOpenFolder); connect(actionMarkAsWatched, SIGNAL(triggered()), this, SLOT(markAsWatched())); connect(actionMarkAsUnwatched, SIGNAL(triggered()), this, SLOT(markAsUnwatched())); connect(actionLoadStreamDetails, SIGNAL(triggered()), this, SLOT(loadStreamDetails())); connect(actionMarkForSync, SIGNAL(triggered()), this, SLOT(markForSync())); connect(actionUnmarkForSync, SIGNAL(triggered()), this, SLOT(unmarkForSync())); connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolder())); connect(ui->files, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(ui->files->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(itemActivated(QModelIndex, QModelIndex))); connect(ui->files->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setAlphaListData())); connect(ui->files, SIGNAL(sigLeftEdge(bool)), this, SLOT(onLeftEdge(bool))); connect(m_alphaList, SIGNAL(sigAlphaClicked(QString)), this, SLOT(scrollToAlpha(QString))); connect(m_concertProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(onViewUpdated())); connect(m_concertProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(onViewUpdated())); }
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!? };
char* executeFolderProtocol(int typeEnde, char protocol[]) { char path[256]; bzero(path, sizeof(path)); int pathStart = typeEnde + 2, pathEnde = 0; while(protocol[pathStart] != '{'){ ++pathStart; } ++pathStart; pathEnde = pathStart; while(protocol[pathEnde] != '}'){ ++pathEnde; } --pathEnde; for (int i = pathStart; i <= pathEnde; ++i) { path[i - pathStart] = protocol[i]; } cout << "Folderpath: " << path << endl; //Modus checken if (!strcmp(path, "ls")){ char message[256] = " "; cout << "modus: ls" << endl; if (entries > 0) { strcpy(message, dirEntries[0]); } for(int i = 1; i < entries; ++i) { strcat(message, dirEntries[i]); strcat(message, "\n"); } cout << "message to send: " << message << endl << "length: " << strlen(message) << endl; return message; } else { if (!strcmp(path, "..")) { strcpy(path, actualPath); if (path != NULL) { int lastPos = 0; for(int i = 0; i < strlen(path); ++i){ if (path[i] == '/') { lastPos = i; } } for(int i = lastPos; i < strlen(path); ++i){ path[i] = '\0'; } } } if (openFolder(path)) { strcpy(actualPath, path); return "success"; } return "failed"; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), defaultPath (QDesktopServices::storageLocation(QDesktopServices::HomeLocation)) { ui->setupUi(this); ui->verticalLayout->setMargin(5); ui->centralWidget->setLayout(ui->verticalLayout); setAcceptDrops(true); mountedView = new ListView (this); connect (mountedView->addNew , SIGNAL(triggered()) , SLOT(addAnother())); connect (mountedView->removeCurrent , SIGNAL(triggered()) , SLOT(removeCurrent())); connect (mountedView , SIGNAL(openFolder(QModelIndex)) , SLOT(openFolder(QModelIndex))); connect (mountedView , SIGNAL(doubleClicked(QModelIndex)) , SLOT(openFolder(QModelIndex))); ui->verticalLayout->addWidget(new QLabel ("Mount / Unmount by drag and drop , double click to open folder")); ui->verticalLayout->addWidget(mountedView); // restore mounted ISO settings.beginGroup("MountInfo"); foreach ( const QString & s , settings.value("IsoImages").toString().split("|") ) { addIso( QString::fromUtf8( QByteArray::fromBase64(s.toAscii())) ); } settings.endGroup(); // restore UI settings.beginGroup("UI"); restoreState( settings.value("State").toByteArray()); restoreGeometry( settings.value("Geo").toByteArray() ); settings.endGroup(); // check if fuseiso is installed if ( ! (packageMissing = checkReq()) ) { QMessageBox::information(this , tr("Missing packages") , tr("fuseiso is not found in $PATH , install it and restart this app.")); } }
bool DirectoryView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setDir((const QString&)static_QUType_QString.get(_o+1)); break; case 1: slotFolderSelected((QListViewItem*)static_QUType_ptr.get(_o+1)); break; case 2: openFolder(); break; default: return QListView::qt_invoke( _id, _o ); } return TRUE; }
void Instance::rightClickMenu(const QPoint& p) { QMenu m; m.addAction("Launch...", this, SLOT(launch())); m.addAction("Open Folder...", this, SLOT(openFolder()), QKeySequence(Qt::CTRL | Qt::Key_I)); if(!isDefaultInstance()) { m.addSeparator(); m.addAction("Browse for icon...", this, SLOT(browseForIcon())); m.addAction("Remove", this, SLOT(removeFromGui())); } m.exec(p); }
FSStatus FSOpenDir(FSClient *client, FSCmdBlock *block, const char *path, be_val<FSDirectoryHandle> *handle, uint32_t flags) { auto fs = gSystem.getFileSystem(); auto dir = fs->openFolder(path); if (!dir) { return FSStatus::NotFound; } *handle = client->addDirectory(dir); return FSStatus::OK; }
void ShowFoto::slotOpenFolder(const QUrl& url) { if (!d->thumbBar->currentInfo().isNull() && !promptUserSave(d->thumbBar->currentUrl())) { return; } m_canvas->load(QString(), m_IOFileSettings); d->thumbBar->showfotoItemInfos().clear(); emit signalNoCurrentItem(); openFolder(url); toggleNavigation(1); }
bool FindFiles::FindItem(bool includeSubFolders, bool skipSystemFolders) { if (m_insearch) { FindNextFileA(m_h, &fd); if (GetLastError() == ERROR_SUCCESS) { if (isValidFolder(skipSystemFolders)) { storeFolder(); } return true; } else { FindClose(m_h); m_h = 0; } while (folders.size()>0) { strcpy(m_currentFolder, folders.front()); folders.pop_front(); if (openFolder(includeSubFolders, skipSystemFolders) == 0) return true; } // NO_MORE_FILES; m_insearch = false; if (m_h) FindClose(m_h); return false; } else { m_insearch = true; strcpy(m_currentFolder, m_root); return openFolder(includeSubFolders, skipSystemFolders) == 0; } } // void FindFiles::SetRoot(const char* root)
void DownloadItem::customContextMenuRequested(const QPoint &pos) { QMenu menu; menu.addAction( tr("Open File"), this, SLOT(openFile())); menu.addAction(tr("Open Folder"), this, SLOT(openFolder())); menu.addSeparator(); menu.addAction(tr("Copy Download Link"), this, SLOT(copyDownloadLink())); menu.addSeparator(); menu.addAction(tr("Cancel Downloading"), this, SLOT(stop()))->setEnabled(downloading_); menu.addAction(tr("Remove"), this, SLOT(clear()))->setEnabled(!downloading_); if (downloading_ || downloadInfo_->text().startsWith(tr("Cancelled")) || downloadInfo_->text().startsWith(tr("Error"))) { menu.actions().at(0)->setEnabled(false); } menu.exec(mapToGlobal(pos)); }
RecordingDialog::RecordingDialog(QWidget *parent) : QWidget(parent), pressedItemLeftButton(0), pressedItemRightButton(0) { recordings_directory = "/tmp/"; recording_quality = 37; recording_format = 0; setWindowIcon( QPixmap(":/icons/logo.png") ); setWindowTitle(tr("Recordings")); clearListButton = new QPushButton(tr("&Clear list"), this); openFolderButton = new QPushButton(tr("&Open folder"), this); downloadList = new QListWidget(this); QHBoxLayout* hbox = new QHBoxLayout; hbox->addWidget(clearListButton); hbox->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Preferred)); hbox->addWidget(openFolderButton); hbox->setContentsMargins(7, 4, 7, 3); MyBorder* border = new MyBorder(this); border ->setBGColor(palette().color(backgroundRole())); QVBoxLayout* vbox = new QVBoxLayout(this); vbox->addWidget(downloadList); vbox->addWidget(border); vbox->addLayout(hbox); vbox->setContentsMargins(0,0,0,0); vbox->setSpacing(0); RecordingDelegate* delegate = new RecordingDelegate(downloadList); downloadList->setItemDelegate(delegate); downloadList->setSelectionMode(QAbstractItemView::SingleSelection); downloadList->setAlternatingRowColors(true); downloadList->viewport()->installEventFilter(this); downloadList->setFrameStyle(QFrame::Plain | QFrame::NoFrame); downloadList->viewport()->setMouseTracking(true); resize(500, 300); QAbstractItemModel* downloadModel = downloadList->model(); connect(clearListButton, SIGNAL(clicked()), this, SLOT(clearList())); connect(downloadModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(updateClearListButton())); connect(downloadModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(updateClearListButton())); connect(downloadList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(videoDoubleClicked(QListWidgetItem*))); connect(downloadModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(updateClearListButton())); connect(openFolderButton, SIGNAL(clicked()), this, SLOT(openFolder())); loadList(); }
void DownloadItem::customContextMenuRequested(const QPoint &pos) { QMenu menu; menu.addAction(QIcon::fromTheme("document-open"), tr("Open File"), this, SLOT(openFile())); menu.addAction(tr("Open Folder"), this, SLOT(openFolder())); menu.addSeparator(); menu.addAction(tr("Go to Download Page"), this, SLOT(goToDownloadPage()))->setEnabled(!m_downloadPage.isEmpty()); menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Download Link"), this, SLOT(copyDownloadLink())); menu.addSeparator(); menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, SLOT(stop()))->setEnabled(m_downloading); menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, SLOT(clear()))->setEnabled(!m_downloading); if (m_downloading || ui->downloadInfo->text().startsWith(tr("Cancelled")) || ui->downloadInfo->text().startsWith(tr("Error"))) { menu.actions().at(0)->setEnabled(false); } menu.exec(mapToGlobal(pos)); }
void ShowFoto::slotDroppedUrls(const QList<QUrl>& droppedUrls) { if (!droppedUrls.isEmpty()) { QList<QUrl> validUrls; foreach (const QUrl& url, droppedUrls) { if (url.isValid()) { validUrls << url; } } d->droppedUrls = true; QList<QUrl> imagesUrls; QList<QUrl> foldersUrls; foreach (const QUrl& url, validUrls) { if (QMimeDatabase().mimeTypeForUrl(url).name().startsWith(QLatin1String("image"), Qt::CaseInsensitive)) { imagesUrls << url; } if (QMimeDatabase().mimeTypeForUrl(url).name() == QLatin1String("inode/directory")) { foldersUrls << url; } } if (!imagesUrls.isEmpty()) { openUrls(imagesUrls); } if (!foldersUrls.isEmpty()) { foreach (const QUrl& fUrl, foldersUrls) { openFolder(fUrl); }
/***************************************************************************** * * Class DirectoryView * *****************************************************************************/ DirectoryView::DirectoryView(QWidget *parent, const char *name, bool sdo) : QListView(parent, name), dirsOnly(sdo), oldCurrent(0), dropItem(0), mousePressed(FALSE) { autoopen_timer = new QTimer(this); if (!folderLocked) { folderLocked = new QPixmap(folder_locked); folderClosed = new QPixmap(folder_closed_xpm); folderOpen = new QPixmap(folder_open_xpm); fileNormal = new QPixmap(pix_file); } connect(this, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(slotFolderSelected(QListViewItem*))); connect(this, SIGNAL(returnPressed(QListViewItem*)), this, SLOT(slotFolderSelected(QListViewItem*))); setAcceptDrops(TRUE); viewport()->setAcceptDrops(TRUE); connect(autoopen_timer, SIGNAL(timeout()), this, SLOT(openFolder())); }
void ShowFoto::slotOpenFilesInFolder() { if (!d->thumbBar->currentInfo().isNull() && !promptUserSave(d->thumbBar->currentUrl())) { return; } QUrl url = QUrl::fromLocalFile(QFileDialog::getExistingDirectory(this, i18n("Open Images From Folder"), d->lastOpenedDirectory.toLocalFile())); if (!url.isEmpty()) { m_canvas->load(QString(), m_IOFileSettings); d->thumbBar->showfotoItemInfos().clear(); d->lastOpenedDirectory = url; emit signalNoCurrentItem(); openFolder(url); toggleNavigation(1); } }
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); }
/*** PUBLIC ***/ br::GalleryToolBar::GalleryToolBar(QWidget *parent) : QToolBar("Gallery", parent) { lGallery.setAlignment(Qt::AlignCenter); lGallery.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); tbOpenFile.setIcon(QIcon(":/glyphicons/png/[email protected]")); tbOpenFile.setToolTip("Load Photo"); tbOpenFolder.setIcon(QIcon(":/glyphicons/png/[email protected]")); tbOpenFolder.setToolTip("Load Photo Folder"); tbWebcam.setCheckable(true); tbWebcam.setIcon(QIcon(":/glyphicons/png/[email protected]")); tbWebcam.setToolTip("Load Webcam"); tbBack.setEnabled(false); tbBack.setIcon(QIcon(":/glyphicons/png/[email protected]")); tbBack.setToolTip("Back"); tbMean.setIcon(QIcon(":/glyphicons/png/[email protected]")); tbMean.setToolTip("Mean Image"); addWidget(&tbOpenFile); addWidget(&tbOpenFolder); addWidget(&tbWebcam); addSeparator(); addWidget(&lGallery); addSeparator(); addWidget(&tbBack); addWidget(&tbMean); setIconSize(QSize(20,20)); connect(&tbOpenFile, SIGNAL(clicked()), this, SLOT(openFile())); connect(&tbOpenFolder, SIGNAL(clicked()), this, SLOT(openFolder())); connect(&tbBack, SIGNAL(clicked()), this, SLOT(home())); connect(&tbMean, SIGNAL(clicked()), this, SLOT(mean())); connect(&enrollmentWatcher, SIGNAL(finished()), this, SLOT(enrollmentFinished())); connect(&timer, SIGNAL(timeout()), this, SLOT(checkWebcam())); timer.start(500); }
QtFileIconViewItem::QtFileIconViewItem( QtFileIconView *parent, QFileInfo *fi ) : QIconViewItem( parent, fi->fileName() ), itemFileName( fi->filePath() ), itemFileInfo( fi ), checkSetText( FALSE ) { vm = QtFileIconView::Large; if ( itemFileInfo->isDir() ) itemType = Dir; else if ( itemFileInfo->isFile() ) itemType = File; if ( itemFileInfo->isSymLink() ) itemType = Link; viewModeChanged( ( (QtFileIconView*)iconView() )->viewMode() ); if ( itemFileInfo->fileName() == "." || itemFileInfo->fileName() == ".." ) setRenameEnabled( FALSE ); checkSetText = TRUE; QObject::connect( &timer, SIGNAL( timeout() ), iconView(), SLOT( openFolder() ) ); }
ProjectsView::ProjectsView( QObject* parent, QWidget* parentWidget ) : View( parent ), m_folderUpdateCounter( 0 ), m_updateCounter( 0 ), m_sessionExpired( false ) { m_systemAdmin = dataManager->currentUserAccess() == AdminAccess; QAction* action; action = new QAction( IconLoader::icon( "file-reload" ), tr( "&Update Projects" ), this ); action->setShortcut( QKeySequence::Refresh ); connect( action, SIGNAL( triggered() ), this, SLOT( updateProjects() ), Qt::QueuedConnection ); setAction( "updateProjects", action ); action = new QAction( IconLoader::icon( "edit-access" ), tr( "&Manage Permissions..." ), this ); action->setIconText( tr( "Permissions" ) ); connect( action, SIGNAL( triggered() ), this, SLOT( managePermissions() ), Qt::QueuedConnection ); setAction( "managePermissions", action ); if ( m_systemAdmin ) { action = new QAction( IconLoader::icon( "project-new" ), tr( "Add &Project..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( addProject() ), Qt::QueuedConnection ); setAction( "addProject", action ); } action = new QAction( IconLoader::icon( "folder-new" ), tr( "Add &Folder..." ), this ); action->setShortcut( QKeySequence::New ); connect( action, SIGNAL( triggered() ), this, SLOT( addFolder() ), Qt::QueuedConnection ); setAction( "addFolder", action ); action = new QAction( IconLoader::icon( "edit-rename" ), tr( "&Rename Folder..." ), this ); action->setIconText( tr( "Rename" ) ); action->setShortcut( tr( "F2" ) ); connect( action, SIGNAL( triggered() ), this, SLOT( editRename() ), Qt::QueuedConnection ); setAction( "editRename", action ); action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Folder" ), this ); action->setIconText( tr( "Delete" ) ); action->setShortcut( QKeySequence::Delete ); connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ), Qt::QueuedConnection ); setAction( "editDelete", action ); action = new QAction( IconLoader::icon( "folder-move" ), tr( "&Move Folder..." ), this ); action->setIconText( tr( "Move" ) ); connect( action, SIGNAL( triggered() ), this, SLOT( moveFolder() ), Qt::QueuedConnection ); setAction( "moveFolder", action ); action = new QAction( IconLoader::icon( "project" ), tr( "&Open Project" ), this ); action->setShortcut( QKeySequence::Open ); connect( action, SIGNAL( triggered() ), this, SLOT( openProject() ), Qt::QueuedConnection ); setAction( "openProject", action ); action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open Folder" ), this ); action->setShortcut( QKeySequence::Open ); connect( action, SIGNAL( triggered() ), this, SLOT( openFolder() ), Qt::QueuedConnection ); setAction( "openFolder", action ); action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open List" ), this ); action->setShortcut( QKeySequence::Open ); connect( action, SIGNAL( triggered() ), this, SLOT( openGlobalList() ), Qt::QueuedConnection ); setAction( "openGlobalList", action ); action = new QAction( IconLoader::icon( "configure-alerts" ), tr( "&Manage Alerts..." ), this ); connect( action, SIGNAL( triggered() ), this, SLOT( manageAlerts() ), Qt::QueuedConnection ); setAction( "manageAlerts", action ); setTitle( "sectionAdd", tr( "Add" ) ); setTitle( "sectionProjects", tr( "Projects" ) ); setDefaultMenuAction( "menuProject", "openProject" ); setDefaultMenuAction( "menuProjectAdmin", "openProject" ); setDefaultMenuAction( "menuFolder", "openFolder" ); setDefaultMenuAction( "menuGlobalList", "openGlobalList" ); loadXmlUiFile( ":/resources/projectsview.xml" ); m_list = new QTreeView( parentWidget ); TreeViewHelper helper( m_list ); helper.initializeView( TreeViewHelper::TreeStyle ); connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ), this, SLOT( contextMenu( const QPoint& ) ) ); connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( doubleClicked( const QModelIndex& ) ) ); setMainWidget( m_list ); }
void DirReader::setExtension(const std::string &str) { extension = str; openFolder(folder); }
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")); };
QString FileUtils::openFolder(SystemFolder folder, bool create) { return openFolder(getFolderStr(folder), create); }
KfindTop::KfindTop(const char *searchPath) : KTopLevelWidget() { // setCaption(QString("KFind ")+KFIND_VERSION); _toolBar = new KToolBar( this, "_toolBar" ); _toolBar->setBarPos( KToolBar::Top ); _toolBar->show(); enableToolBar( KToolBar::Show, addToolBar( _toolBar ) ); _kfind = new Kfind(this,"dialog",searchPath); setView( _kfind, FALSE ); _kfind->show(); menuInit(); toolBarInit(); setMenu(_mainMenu); _mainMenu->show(); //_mainMenu->enableMoving(false); _statusBar = new KStatusBar( this, "_statusBar"); _statusBar->insertItem("0 file(s) found", 0); _statusBar->enable(KStatusBar::Hide); setStatusBar( _statusBar ); connect(_kfind,SIGNAL(haveResults(bool)), this,SLOT(enableSaveResults(bool))); connect(_kfind,SIGNAL(resultSelected(bool)), this,SLOT(enableMenuItems(bool))); connect(this,SIGNAL(deleteFile()), _kfind,SIGNAL(deleteFile())); connect(this,SIGNAL(properties()), _kfind,SIGNAL(properties())); connect(this,SIGNAL(openFolder()), _kfind,SIGNAL(openFolder())); connect(this,SIGNAL(saveResults()), _kfind,SIGNAL(saveResults())); connect(this,SIGNAL(addToArchive()), _kfind,SIGNAL(addToArchive())); connect(this,SIGNAL(open()), _kfind,SIGNAL(open())); connect(_kfind ,SIGNAL(statusChanged(const char *)), this,SLOT(statusChanged(const char *))); connect(_kfind ,SIGNAL(enableSearchButton(bool)), this,SLOT(enableSearchButton(bool))); connect(_kfind ,SIGNAL(enableStatusBar(bool)), this,SLOT(enableStatusBar(bool))); // No, No, No!!! This is pointless! (sven) // connect(_mainMenu ,SIGNAL(moved(menuPosition)), // this,SLOT(resizeOnFloating())); // connect(_toolBar ,SIGNAL(moved(BarPosition)), // this,SLOT(resizeOnFloating())); //_width=(440>_toolBar->width())?440:_toolBar->width(); _width=520; //_height=(_kfind->sizeHint()).height(); // Unused as far as I can tell // Fixed and Y-fixed guys: Please, please, please stop setting fixed size // on KTW! Fix it on your main view! // sven this->enableStatusBar(false); // _kfile emited before connected (sven) }; // and what's this semi-colon for? Grrrr!!!! (sven, too)
/* * folder.cpp * * Created on: 06.02.2016 * Author: tilo */ #include "../h/folder.h" char* home = "/home"; DIR* actualFolder = opendir(home); char actualPath[256]; char* dirEntries[256]; int entries = 0; bool initialized = openFolder(home); bool openFolder(char folder[]){ /* //get timestamp struct stat attrib; stat("README.md", &attrib); cout << localtime(&attrib.st_mtim.tv_sec)->tm_hour << endl;*/ if(!initialized && strcmp(folder, home)) { cout << "error: folder not initialized" << endl; return false; } if(strncmp(folder, home, strlen(home))) { cout << "Folder could not be opened!" << endl << "You don't have the rights to do so!" << endl; return false;
/** * @brief FilesWidget::FilesWidget * @param parent */ FilesWidget::FilesWidget(QWidget *parent) : QWidget(parent), ui(new Ui::FilesWidget) { m_instance = this; ui->setupUi(this); ui->statusLabel->setText(tr("%n movies", "", 0)); #ifdef Q_OS_MAC QFont font = ui->files->font(); font.setPointSize(font.pointSize()-2); ui->files->setFont(font); #endif #ifdef Q_OS_WIN32 ui->verticalLayout->setContentsMargins(0, 0, 0, 1); #endif m_lastMovie = 0; m_mouseIsIn = false; m_movieProxyModel = new MovieProxyModel(this); m_movieProxyModel->setSourceModel(Manager::instance()->movieModel()); m_movieProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_movieProxyModel->setDynamicSortFilter(true); ui->files->setModel(m_movieProxyModel); for (int i=1, n=ui->files->model()->columnCount() ; i<n ; ++i) { ui->files->setColumnWidth(i, 24); ui->files->setColumnHidden(i, true); } ui->files->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); ui->files->setIconSize(QSize(12, 12)); foreach (const MediaStatusColumns &column, Settings::instance()->mediaStatusColumns()) ui->files->setColumnHidden(MovieModel::mediaStatusToColumn(column), false); m_alphaList = new AlphabeticalList(this, ui->files); m_baseLabelCss = ui->sortByYear->styleSheet(); m_activeLabelCss = ui->sortByNew->styleSheet(); QMenu *mediaStatusColumnsMenu = new QMenu(tr("Media Status Columns"), ui->files); for (int i=MediaStatusFirst, n=MediaStatusLast ; i<=n ; ++i) { QAction *action = new QAction(MovieModel::mediaStatusToText(static_cast<MediaStatusColumns>(i)), this); action->setProperty("mediaStatusColumn", i); action->setCheckable(true); action->setChecked(Settings::instance()->mediaStatusColumns().contains(static_cast<MediaStatusColumns>(i))); connect(action, SIGNAL(triggered()), this, SLOT(onActionMediaStatusColumn())); mediaStatusColumnsMenu->addAction(action); } QMenu *labelsMenu = new QMenu(tr("Label"), ui->files); QMapIterator<int, QString> it(Helper::instance()->labels()); while (it.hasNext()) { it.next(); QAction *action = new QAction(it.value(), this); action->setIcon(Helper::instance()->iconForLabel(it.key())); action->setProperty("color", it.key()); connect(action, SIGNAL(triggered()), this, SLOT(onLabel())); labelsMenu->addAction(action); } QAction *actionMultiScrape = new QAction(tr("Load Information"), this); QAction *actionMarkAsWatched = new QAction(tr("Mark as watched"), this); QAction *actionMarkAsUnwatched = new QAction(tr("Mark as unwatched"), this); QAction *actionLoadStreamDetails = new QAction(tr("Load Stream Details"), this); QAction *actionMarkForSync = new QAction(tr("Add to Synchronization Queue"), this); QAction *actionUnmarkForSync = new QAction(tr("Remove from Synchronization Queue"), this); QAction *actionOpenFolder = new QAction(tr("Open Movie Folder"), this); m_contextMenu = new QMenu(ui->files); m_contextMenu->addAction(actionMultiScrape); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionMarkAsWatched); m_contextMenu->addAction(actionMarkAsUnwatched); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionLoadStreamDetails); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionMarkForSync); m_contextMenu->addAction(actionUnmarkForSync); m_contextMenu->addSeparator(); m_contextMenu->addAction(actionOpenFolder); m_contextMenu->addSeparator(); m_contextMenu->addMenu(labelsMenu); m_contextMenu->addMenu(mediaStatusColumnsMenu); connect(actionMultiScrape, SIGNAL(triggered()), this, SLOT(multiScrape())); connect(actionMarkAsWatched, SIGNAL(triggered()), this, SLOT(markAsWatched())); connect(actionMarkAsUnwatched, SIGNAL(triggered()), this, SLOT(markAsUnwatched())); connect(actionLoadStreamDetails, SIGNAL(triggered()), this, SLOT(loadStreamDetails())); connect(actionMarkForSync, SIGNAL(triggered()), this, SLOT(markForSync())); connect(actionUnmarkForSync, SIGNAL(triggered()), this, SLOT(unmarkForSync())); connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolder())); connect(ui->files, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(ui->files->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(itemActivated(QModelIndex, QModelIndex))); connect(ui->files->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(setAlphaListData())); connect(ui->files, SIGNAL(sigLeftEdge(bool)), this, SLOT(onLeftEdge(bool))); connect(ui->files, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(playMovie(QModelIndex))); connect(m_alphaList, SIGNAL(sigAlphaClicked(QString)), this, SLOT(scrollToAlpha(QString))); connect(ui->sortByNew, SIGNAL(clicked()), this, SLOT(onSortByNew())); connect(ui->sortByName, SIGNAL(clicked()), this, SLOT(onSortByName())); connect(ui->sortByLastAdded, SIGNAL(clicked()), this, SLOT(onSortByAdded())); connect(ui->sortBySeen, SIGNAL(clicked()), this, SLOT(onSortBySeen())); connect(ui->sortByYear, SIGNAL(clicked()), this, SLOT(onSortByYear())); connect(m_movieProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(onViewUpdated())); connect(m_movieProxyModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(onViewUpdated())); }