Exemple #1
0
int main (int argc, char *argv[]) {
  int c;
  int recurs = 0;
  int writeSize = 0;
  while ((c = getopt (argc, argv, "rfs:")) != -1) {
    switch (c) {
      case 's':
        writeSize=strtol(optarg, NULL, 10);
        break;
      case 'f':
        break;
      case 'r':
        recurs=1;
        break;
      default:
        abort();
    }
  }
  
  if (optind > argc - 1) {
    return 0;
  }

  int status = 0;
  
  switch(recurs) {
    case 1:
      status = deleteFiles(argv[optind]);
      break;
    default:
      status = deleteFile(argv[optind]);
  }
}
Exemple #2
0
void setup() {
  Serial.begin(BPS_115200);
  PgmPrintln("Type any character to start");
  while (!Serial.available());
  
  // initialize the SD card at SPI_FULL_SPEED for best performance.
  // try SPI_HALF_SPEED if bus errors occur.
  if (!card.init(SPI_FULL_SPEED)) error("card.init failed");
  
  // initialize a FAT volume
  if (!volume.init(&card)) error("volume.init failed");

  // open the root directory
  if (!root.openRoot(&volume)) error("openRoot failed");
  
  // delete files in root if FAT32
  if (volume.fatType() == 32) {
    PgmPrintln("Remove files in root");
    deleteFiles(root);
  }
  
  // open SUB1 and delete files
  SdFile sub1;
  if (!sub1.open(&root, "SUB1", O_READ)) error("open SUB1 failed");
  PgmPrintln("Remove files in SUB1");
  deleteFiles(sub1);

  // open SUB2 and delete files
  SdFile sub2;
  if (!sub2.open(&sub1, "SUB2", O_READ)) error("open SUB2 failed");
  PgmPrintln("Remove files in SUB2");
  deleteFiles(sub2);

  // remove SUB2
  if (!sub2.rmDir()) error("sub2.rmDir failed");
  PgmPrintln("SUB2 removed");
  
  // remove SUB1
  if (!sub1.rmDir()) error("sub1.rmDir failed");
  PgmPrintln("SUB1 removed");

  PgmPrintln("Done");
}
Exemple #3
0
void ControlPanel::delButtonClicked( bool /*checked*/ )
{
    movie->start();
    if( leftPanel->lastFocus() > rightPanel->lastFocus() )
    {
        QStringList list = leftPanel->selectedFiles();
        qDebug()<<"files to delete : "<<list;
        if( list.count() > 0 )
            deleteFiles( list, true );
    }
    else
    {
        QStringList list = rightPanel->selectedFiles();
        qDebug()<<"files to delete : "<<list;
        if( list.count() > 0 )
            deleteFiles( list, false );
    }
    movie->stop();
}
bool
CWin32Platform::removeFileOrFolder(const char* filePath) {
	const char * target = "file://external/";
	int len = strlen(target);
	if(!strncmp(filePath, target, len)) {
		return deleteFiles(filePath);
	} else {
		return false;
	}
}
	void LogTraceListener::processProcInner()
	{
		QDateTime now = QDateTime::currentDateTime();
		// Try to create new log file.
		createFile(now);

		// Try to delete some log files at 1 AM.
		deleteFiles(now);

		flushInner();

		_diskIsFull = isDiskFull();
	}
Exemple #6
0
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);
}
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	_ui(new Ui::MainWindow),
	_clipboard(QApplication::clipboard()),
	_proxyModel(new QSortFilterProxyModel),
	_storageModel(),
	_objectModel(new MtpObjectsModel()),
	_uploader(new FileUploader(_objectModel, this))
{
	_ui->setupUi(this);
	setWindowIcon(QIcon(":/android-file-transfer.png"));

	_ui->listView->setModel(_proxyModel);

	_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
	_proxyModel->sort(0);
	_proxyModel->setDynamicSortFilter(true);

	_objectModel->moveToThread(QApplication::instance()->thread());

	connect(_ui->listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), SLOT(updateActionsState()));
	connect(_ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(onActivated(QModelIndex)));
	connect(_ui->listView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
	connect(_ui->actionBack, SIGNAL(triggered()), SLOT(back()));
	connect(_ui->actionGo_Down, SIGNAL(triggered()), SLOT(down()));
	connect(_ui->actionCreateDirectory, SIGNAL(triggered()), SLOT(createDirectory()));
	connect(_ui->actionUploadDirectory, SIGNAL(triggered()), SLOT(uploadDirectories()));
	connect(_ui->actionUpload_Album, SIGNAL(triggered()), SLOT(uploadAlbum()));
	connect(_ui->actionUpload, SIGNAL(triggered()), SLOT(uploadFiles()));
	connect(_ui->actionRename, SIGNAL(triggered()), SLOT(renameFile()));
	connect(_ui->actionDownload, SIGNAL(triggered()), SLOT(downloadFiles()));
	connect(_ui->actionDelete, SIGNAL(triggered()), SLOT(deleteFiles()));
	connect(_ui->storageList, SIGNAL(activated(int)), SLOT(onStorageChanged(int)));
	connect(_ui->actionRefresh, SIGNAL(triggered()), SLOT(refresh()));
	connect(_ui->actionPaste, SIGNAL(triggered()), SLOT(pasteFromClipboard()));

	connect(_objectModel, SIGNAL(onFilesDropped(QStringList)), SLOT(uploadFiles(QStringList)));
	connect(_objectModel, SIGNAL(existingFileOverwrite(QString)), SLOT(confirmOverwrite(QString)), Qt::BlockingQueuedConnection);

	connect(_clipboard, SIGNAL(dataChanged()), SLOT(validateClipboard()));
	validateClipboard();

	//fixme: find out how to specify alternative in designer
	_ui->actionBack->setShortcuts(_ui->actionBack->shortcuts() << QKeySequence("Alt+Up") << QKeySequence("Esc"));
	_ui->actionGo_Down->setShortcuts(_ui->actionGo_Down->shortcuts() << QKeySequence("Alt+Down") << QKeySequence("Enter"));
	_ui->actionCreateDirectory->setShortcuts(_ui->actionCreateDirectory->shortcuts() << QKeySequence("F7"));
	_ui->actionRefresh->setShortcuts(_ui->actionRefresh->shortcuts() << QKeySequence("Ctrl+R"));
	_ui->listView->setFocus();
}
Exemple #8
0
void Worker::run()
{
    // Perform file operation
    switch (m_fileOperation)
    {
        case Paste:
            pasteFiles(false);
            break;
        case CutPaste:
            pasteFiles(true);
            break;
        case Delete:
            deleteFiles();
            break;
    }
}
Exemple #9
0
void CopyApp::doUpdate()
{
    static int partial = 0;
    if(partial == 0) {
        if(!checkPermissions(destination)) {
            startAsSudo();
            QApplication::quit();
            return;
        }
    }
    partial += 500;
    if(timeToWait != 0) {
        ui->progressBar->setValue(partial * 100 / timeToWait);
        if(partial < timeToWait) {
            QTimer::singleShot(500, this, SLOT(doUpdate()));
            return;
        }
    }
    emit currentOperation(tr("Looking for local file list info"));
    QStringList destinationFileList = processFileList(destination);
    emit currentOperation(tr("Looking for remote file list info"));
    QStringList remoteFileList = processFileList(origin);
    if(destinationFileList.isEmpty() || remoteFileList.isEmpty())
        return;
    emit currentOperation(tr("Deleting old files..."));
    bool result = true;
    result &= deleteFiles(destinationFileList, destination);
    emit currentOperation(tr("Copying new files..."));
    result &= copyFiles(remoteFileList, origin, destination);
    QString resultStr;
    if(result)
        resultStr = tr("Update finished successfully. ");
    else
        resultStr = tr("Update finished with errors. ");
    if(!appToRun.isEmpty())
        resultStr = resultStr + tr("Click ok to restart application");
    QMessageBox::information(this, tr("Update finished"), resultStr);
    if(!appToRun.isEmpty()) {
 #ifdef Q_OS_OSX
        QProcess::startDetached("open", QStringList() << QDir(destination).filePath(appToRun));
#else
        QProcess::startDetached(QDir(destination).filePath(appToRun));
#endif
    }
    QApplication::quit();
}
Exemple #10
0
int main(){
	time_t t1, t2;
	double t0;
	time(&t1);
	
	FILE *dataFile;
	dataFile = fopen("cs451.conf", "r");
	if (dataFile == NULL)
	{
		printf("cannot open file\n");
		exit(0);
	}
	char temp[128];
	char item[128];
	char maxProcesses[42], timeQuantum[42];
	while(fscanf(dataFile, "%s", temp) != EOF)
	{
		if (strstr(temp, "processes:") != NULL)
		{
			fscanf(dataFile, "%s", maxProcesses);
		}
		else if (strstr(temp, "quantum:") != NULL)
		{
			fscanf(dataFile, "%s", timeQuantum);
		}
		else if (strstr(temp, ":") != NULL)
		{
			fscanf(dataFile, "%s", item);
		}
	}
	fclose(dataFile);
	
	createFiles();
	
	fillQueue(atoi(maxProcesses));
	//printQueue();
	simulate(atoi(maxProcesses));
	freeStuff();
	
	deleteFiles();
	
	time(&t2);
	t0 = difftime(t2, t1);
	printf("Program run-time: %.0f seconds\n", t0);
}
Exemple #11
0
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 ReferenceManager::initialize()
    {
        deleteReferences ();
        deleteFiles ();

        if ( !ExportOptions::exportXRefs() || ExportOptions::dereferenceXRefs() ) return;

#if MAYA_API_VERSION >= 600

        MStatus status;
        MStringArray referenceFilenames;
        MFileIO::getReferences ( referenceFilenames );

        uint referenceCount = referenceFilenames.length();
        mReferences.reserve( referenceCount );
        for (uint i = 0; i < referenceCount; ++i)
        {
            MString& filename = referenceFilenames[i];
            MObject referenceNode = getReferenceNode ( filename );
            if ( referenceNode != MObject::kNullObj ) processReference ( referenceNode );
        }
#endif
    }
Exemple #13
0
int main() {
	int flag,no,size,data;
	struct node *root;
	root = defaultFile();
	root->size=1000;
	data=100;
	flag=no=size=0;
	while( flag==0 ) {
		printf("Enter no's \n1.insert\n 2.Delete\n 3.Print files \n 4.Exit\n");
		scanf("%d",&no);
		printf(" no is %d\n",no);
		switch(no) {
			case 1:
				printf("Enter file size\n");
				scanf("%d",&size);
				root = insert(root, size, data);
				data = data+1;
				break;
			case 2:
				printf("Enter file name to delete\n");
				scanf("%d",&size);
				root = deleteFiles(root, size);
				break;
			case 3:
				printFiles(root);
				break;
			case 4:
				flag=1;
				printf("Quitting from loop\n");
				break;
			default:
				printf("Enter a valid no \n");
				break;
		}
	}
}
Exemple #14
0
// do-loop for gaming till one player has lost (starting at 1)
const unsigned int Game::doStart(const bool contest)
{
    do
    {
#ifdef DEBUG
        std::cout << "Player's " << m_currentPlayer+1 << " turn!" << std::endl;
#endif        

        if ( !writeData() )
        {
            break;
        }

#ifdef DEBUG
        // print game field
        m_field.print();
#endif

        if ( !contest )
        {
            std::cout << "Manually save result.dat and hit enter!" << std::endl;
            getchar();
        }
        else
        {
            // call routine for AI
            if ( 0 == m_currentPlayer )
            {
                if ( system ("./fm-ai1.bin") )
                {
                    std::cout << "Game::doStart() error: calling fm-ai1 failed" << std::endl;
                    // this player will loose the contest
                    m_player[m_currentPlayer].looseAllLife();
                    
                    break;
                }
            }
            else
            {
                if ( system ("./fm-ai2.bin") )
                {
                    std::cout << "Game::doStart() error: calling fm-ai2 failed" << std::endl;

                    // this player will loose the contest
                    m_player[m_currentPlayer].looseAllLife();

                    break;
                }
            }
        }
        
        // now we must read the result that has stored to positions
        FieldPos pos1, pos2;
        if ( !readResult(pos1, pos2) )
        {
            // file could not be read
            break;   
        }
        
#ifdef DEBUG
        std::cout << "Game::doStart() info: swap "
                  << pos1.x() << " " << pos1.y() << " with "
                  << pos2.x() << " " << pos2.y() << std::endl;
#endif
        
        // delete files
        deleteFiles();
        
        // switch positions on game field
        if ( m_field.swapTiles(pos1, pos2) )
        {
            // remove all matching tiles
            if ( !cascade(contest) )
            {
                break;
            }

        }
        else
        {
#ifdef DEBUG
            std::cout << "Game::doStart() Illegal move: loose 5 life"
                      << std::endl;
#endif
            m_player[m_currentPlayer].looseLife(5);
            // getchar();
        }

        // set next player (if necessary)
        nextPlayer();

        // check if gamefield is playable and remove lower lines
        // until the game is playable again
        if ( !checkIfPlayable(contest) )
        {
            break;                
        }
        
#ifdef DEBUG
        // print player info
        printPlayers();
#endif
        
        // getchar();
        
    } while ( !isOnePlayerDead() );
    
    return checkWhosDead();
}
	void LogTraceListener::deleteUnuseFiles()
	{
		deleteFiles(_reservationDays);
	}
void CMainWindow::initButtons()
{
	connect(ui->btnView, &QPushButton::clicked, this, &CMainWindow::viewFile);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F3"), this, SLOT(viewFile()), 0, Qt::WidgetWithChildrenShortcut)));

	connect(ui->btnEdit, &QPushButton::clicked, this, &CMainWindow::editFile);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F4"), this, SLOT(editFile()), 0, Qt::WidgetWithChildrenShortcut)));

	connect(ui->btnCopy, &QPushButton::clicked, this, &CMainWindow::copySelectedFiles);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F5"), this, SLOT(copySelectedFiles()), 0, Qt::WidgetWithChildrenShortcut)));

	connect(ui->btnMove, &QPushButton::clicked, this, &CMainWindow::moveSelectedFiles);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F6"), this, SLOT(moveSelectedFiles()), 0, Qt::WidgetWithChildrenShortcut)));

	connect(ui->btnNewFolder, &QPushButton::clicked, this, &CMainWindow::createFolder);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F7"), this, SLOT(createFolder()), 0, Qt::WidgetWithChildrenShortcut)));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Shift+F7"), this, SLOT(createFile()), 0, Qt::WidgetWithChildrenShortcut)));

	connect(ui->btnDelete, &QPushButton::clicked, this, &CMainWindow::deleteFiles);
	connect(ui->btnDelete, &QPushButton::customContextMenuRequested, this, &CMainWindow::showRecycleBInContextMenu);
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("F8"), this, SLOT(deleteFiles()), 0, Qt::WidgetWithChildrenShortcut)));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Delete"), this, SLOT(deleteFiles()), 0, Qt::WidgetWithChildrenShortcut)));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Shift+F8"), this, SLOT(deleteFilesIrrevocably()), 0, Qt::WidgetWithChildrenShortcut)));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Shift+Delete"), this, SLOT(deleteFilesIrrevocably()), 0, Qt::WidgetWithChildrenShortcut)));

	// Command line
	ui->commandLine->setSelectPreviousItemShortcut(QKeySequence("Ctrl+E"));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Ctrl+E"), this, SLOT(selectPreviousCommandInTheCommandLine()), 0, Qt::WidgetWithChildrenShortcut)));
	_shortcuts.push_back(std::shared_ptr<QShortcut>(new QShortcut(QKeySequence("Esc"), this, SLOT(clearCommandLineAndRestoreFocus()), 0, Qt::WidgetWithChildrenShortcut)));
}
ListPanelActions::ListPanelActions(QObject *parent, FileManagerWindow *mainWindow) :
        ActionsBase(parent, mainWindow)
{
    // set view type
    QSignalMapper *mapper = new QSignalMapper(this);
    connect(mapper, SIGNAL(mapped(int)), SLOT(setView(int)));
    QActionGroup *group = new QActionGroup(this);
    group->setExclusive(true);
    QList<KrViewInstance*> views = KrViewFactory::registeredViews();
    for(int i = 0; i < views.count(); i++) {
        KrViewInstance *inst = views[i];
        QAction *action = new QAction(QIcon::fromTheme(inst->icon()), inst->description(), group);
        action->setCheckable(true);
        connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
        mapper->setMapping(action, inst->id());
        _mainWindow->actions()->addAction("view" + QString::number(i), action);
        _mainWindow->actions()->setDefaultShortcut(action, inst->shortcut());
        setViewActions.insert(inst->id(), action);
    }

    // standard actions
    actHistoryBackward = stdAction(KStandardAction::Back, _func, SLOT(historyBackward()));
    actHistoryForward = stdAction(KStandardAction::Forward, _func, SLOT(historyForward()));
    //FIXME: second shortcut for up: see actDirUp
    //   KStandardAction::up( this, SLOT( dirUp() ), actionCollection )->setShortcut(Qt::Key_Backspace);
    /* Shortcut disabled because of the Terminal Emulator bug. */
    actDirUp = stdAction(KStandardAction::Up, _func, SLOT(dirUp()));
    actHome = stdAction(KStandardAction::Home, _func, SLOT(home()));
    stdAction(KStandardAction::Cut, _func, SLOT(cut()));
    actCopy = stdAction(KStandardAction::Copy, _func, SLOT(copyToClipboard()));
    actPaste = stdAction(KStandardAction::Paste, _func, SLOT(pasteFromClipboard()));

    // Fn keys
    actF2 = action(i18n("Rename"), 0, Qt::Key_F2, _func, SLOT(rename()) , "F2_Rename");
    actF3 = action(i18n("View File"), 0, Qt::Key_F3, _func, SLOT(view()), "F3_View");
    actF4 = action(i18n("Edit File"), 0, Qt::Key_F4, _func, SLOT(edit()) , "F4_Edit");
    actF5 = action(i18n("Copy to other panel"), 0, Qt::Key_F5, _func, SLOT(copyFiles()) , "F5_Copy");
    actF6 = action(i18n("Move..."), 0, Qt::Key_F6, _func, SLOT(moveFiles()) , "F6_Move");
    actShiftF5 = action(i18n("Copy by queue..."), 0, Qt::SHIFT + Qt::Key_F5, _func, SLOT(copyFilesByQueue()) , "F5_Copy_Queue");
    actShiftF6 = action(i18n("Move by queue..."), 0, Qt::SHIFT + Qt::Key_F6, _func, SLOT(moveFilesByQueue()) , "F6_Move_Queue");
    actF7 = action(i18n("New Directory..."), "folder-new", Qt::Key_F7, _func, SLOT(mkdir()) , "F7_Mkdir");
    actF8 = action(i18n("Delete"), "edit-delete", Qt::Key_F8, _func, SLOT(deleteFiles()) , "F8_Delete");
    actF9 = action(i18n("Start Terminal Here"), "utilities-terminal", Qt::Key_F9, _func, SLOT(terminal()) , "F9_Terminal");
    action(i18n("&New Text File..."), "document-new", Qt::SHIFT + Qt::Key_F4, _func, SLOT(editNew()), "edit_new_file");
    action(i18n("F3 View Dialog"), 0, Qt::SHIFT + Qt::Key_F3, _func, SLOT(viewDlg()), "F3_ViewDlg");

    // file operations
    action(i18n("Right-click Menu"), 0, Qt::Key_Menu, _gui, SLOT(rightclickMenu()), "rightclick menu");
    actProperties = action(i18n("&Properties..."), 0, Qt::ALT + Qt::Key_Return, _func, SLOT(properties()), "properties");
    actCompDirs = action(i18n("&Compare Directories"), "kr_comparedirs", Qt::ALT + Qt::SHIFT + Qt::Key_C, _gui, SLOT(compareDirs()), "compare dirs");
    actCalculate = action(i18n("Calculate &Occupied Space"), "accessories-calculator", 0, _func, SLOT(calcSpace()), "calculate");
    actPack = action(i18n("Pac&k..."), "archive-insert", Qt::ALT + Qt::SHIFT + Qt::Key_P, _func, SLOT(pack()), "pack");
    actUnpack = action(i18n("&Unpack..."), "archive-extract", Qt::ALT + Qt::SHIFT + Qt::Key_U, _func, SLOT(unpack()), "unpack");
    actCreateChecksum = action(i18n("Create Checksum..."), "document-edit-sign", 0, _func, SLOT(createChecksum()), "create checksum");
    actMatchChecksum = action(i18n("Verify Checksum..."), "document-edit-decrypt-verify", 0, _func, SLOT(matchChecksum()), "match checksum");
    action(i18n("New Symlink..."), 0, Qt::CTRL + Qt::ALT + Qt::Key_S, _func, SLOT(krlink()), "new symlink");
    actTest = action(i18n("T&est Archive"), "archive-extract", Qt::ALT + Qt::SHIFT + Qt::Key_E, _func, SLOT(testArchive()), "test archives");

    // navigation
    actRoot = action(i18n("Root"), "folder-red", Qt::CTRL + Qt::Key_Backspace, _func, SLOT(root()), "root");
    actCdToOther = action(i18n("Go to Other Panel's Directory"), 0, Qt::CTRL + Qt::Key_Equal, _func, SLOT(cdToOtherPanel()), "cd to other panel");
    action(i18n("&Reload"), "view-refresh", Qt::CTRL + Qt::Key_R, _func, SLOT(refresh()), "std_redisplay");
    actCancelRefresh = action(i18n("Cancel Refresh of View"), "dialog-cancel", 0, _gui, SLOT(inlineRefreshCancel()), "cancel refresh");
    actFTPNewConnect = action(i18n("New Net &Connection..."), "network-connect", Qt::CTRL + Qt::Key_N, _func, SLOT(newFTPconnection()), "ftp new connection");
    actFTPDisconnect = action(i18n("Disconnect &from Net"), "network-disconnect", Qt::SHIFT + Qt::CTRL + Qt::Key_F, _func, SLOT(FTPDisconnect()), "ftp disconnect");
    action(i18n("Sync Panels"), 0, Qt::ALT + Qt::SHIFT + Qt::Key_O, _func, SLOT(syncOtherPanel()), "sync panels");
    actJumpBack = action(i18n("Jump Back"), "go-jump", Qt::CTRL + Qt::Key_J, _gui, SLOT(jumpBack()), "jump_back");
    actSetJumpBack = action(i18n("Set Jump Back Point"), "go-jump-definition", Qt::CTRL + Qt::SHIFT + Qt::Key_J, _gui, SLOT(setJumpBack()), "set_jump_back");
    actSyncBrowse = action(i18n("S&ynchron Directory Changes"), "kr_syncbrowse_off", Qt::ALT + Qt::SHIFT + Qt::Key_Y, _gui, SLOT(toggleSyncBrowse()), "sync browse");
    actLocationBar = action(i18n("Go to Location Bar"), 0, Qt::CTRL + Qt::Key_L, _gui, SLOT(editLocation()), "location_bar");
    toggleAction(i18n("Toggle Popup Panel"), 0, Qt::ALT + Qt::Key_Down, _gui, SLOT(togglePanelPopup()), "toggle popup panel");
    action(i18n("Bookmarks"), 0, Qt::CTRL + Qt::Key_D, _gui, SLOT(openBookmarks()), "bookmarks");
    action(i18n("Left Bookmarks"), 0, 0, this, SLOT(openLeftBookmarks()), "left bookmarks");
    action(i18n("Right Bookmarks"), 0, 0, this, SLOT(openRightBookmarks()), "right bookmarks");
    action(i18n("History"), 0, Qt::CTRL + Qt::Key_H, _gui, SLOT(openHistory()), "history");
    action(i18n("Left History"), 0, Qt::ALT + Qt::CTRL + Qt::Key_Left, this, SLOT(openLeftHistory()), "left history");
    action(i18n("Right History"), 0, Qt::ALT + Qt::CTRL + Qt::Key_Right, this, SLOT(openRightHistory()), "right history");
    action(i18n("Media"), 0, Qt::CTRL + Qt::Key_M, _gui, SLOT(openMedia()), "media");
    action(i18n("Left Media"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Left, this, SLOT(openLeftMedia()), "left media");
    action(i18n("Right Media"), 0, Qt::CTRL + Qt::SHIFT + Qt::Key_Right, this, SLOT(openRightMedia()), "right media");

    // and at last we can set the tool-tips
    actRoot->setToolTip(i18n("ROOT (/)"));

    actF2->setToolTip(i18n("Rename file, directory, etc."));
    actF3->setToolTip(i18n("Open file in viewer."));
    actF4->setToolTip("<qt>" + i18n("<p>Edit file.</p>"
                                 "<p>The editor can be defined in Konfigurator, "
                                 "default is <b>internal editor</b>.</p>") + "</qt>");
    actF5->setToolTip(i18n("Copy file from one panel to the other."));
    actF6->setToolTip(i18n("Move file from one panel to the other."));
    actF7->setToolTip(i18n("Create directory in current panel."));
    actF8->setToolTip(i18n("Delete file, directory, etc."));
    actF9->setToolTip("<qt>" + i18n("<p>Open terminal in current directory.</p>"
                                 "<p>The terminal can be defined in Konfigurator, "
                                 "default is <b>konsole</b>.</p>") + "</qt>");
}
Exemple #18
0
void  readKeyboard(void)
{
	struct dir_node *currentNode;
	unsigned char key;
	bool decision = false;

	key = toupper(cgetc());

	switch((int)key)
	{
	case HK_FORMATTER:
		if(loadOverlay(7))
		{
			formatDisk(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;
	case HK_BASIC_VIEWER:
		if(loadOverlay(6))
		{
			viewFileAsBASIC(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;
	case HK_HEX_EDIT:
		if(loadOverlay(5))
		{
			hexEditCurrentFile(selectedPanel);

			clrscr();
			writeMenuBar();
			reloadPanels();
		}
		break;

	case CH_ENTER:
		currentNode = getSelectedNode(selectedPanel);
		if(isDirectory(selectedPanel))
		{
			enterDirectory(selectedPanel);
		}
		else if(currentNode != NULL)
		{
			sprintf(filePath, "%s/%s", selectedPanel->path, currentNode->name);
			if(currentNode->type == 0x06
				|| currentNode->type == 0xFF)
			{
				saveScreen();
				decision = writeYesNo("Confirm", quit_message, 1);
				retrieveScreen();

				if(decision == true)
				{
					exec(filePath, NULL);
				}
			}
			else if(currentNode->type == 0xFC)
			{
				if(loadOverlay(6))
				{
					viewFileAsBASIC(selectedPanel);

					clrscr();
					writeMenuBar();
					reloadPanels();
				}
			}
			else
			{
				if(loadOverlay(1))
					viewFile(filePath);
			}
		}
		break;
	case KEY_F4:
		rereadSelectedPanel();
		break;
	case KEY_F3:
		selectDrive(selectedPanel);
		rereadSelectedPanel();
		break;
	case HK_SELECT:
		selectCurrentFile();
		break;
#ifdef __APPLE2ENH__
		case CH_CURS_UP:
#else
		case CH_CURS_LEFT:
#endif
		moveSelectorUp(selectedPanel);
		break;
#ifdef __APPLE2ENH__
		case CH_CURS_DOWN:
#else
		case CH_CURS_RIGHT:
#endif
		moveSelectorDown(selectedPanel);
		break;
#ifdef __APPLE2ENH__
	case CH_CURS_LEFT:
		if(selectedPanel == &rightPanelDrive
			&& strlen(leftPanelDrive.path) > 0)
		{
			selectedPanel = &leftPanelDrive;
			writeSelectorPosition(&leftPanelDrive, '>');
			writeSelectorPosition(&rightPanelDrive, ' ');
			writeCurrentFilename(selectedPanel);
		}
		break;
	case CH_CURS_RIGHT:
		if(selectedPanel == &leftPanelDrive
			&& strlen(rightPanelDrive.path) > 0)
		{
			selectedPanel = &rightPanelDrive;
			writeSelectorPosition(&leftPanelDrive, ' ');
			writeSelectorPosition(&rightPanelDrive, '>');
			writeCurrentFilename(selectedPanel);
		}
		break;
#endif
	case HK_SWITCH_PANEL:
		if(selectedPanel == &leftPanelDrive
			&& strlen(rightPanelDrive.path) > 0)
		{
			selectedPanel = &rightPanelDrive;
			writeSelectorPosition(&leftPanelDrive, ' ');
			writeSelectorPosition(&rightPanelDrive, '>');
			writeCurrentFilename(selectedPanel);
		}
		else if(selectedPanel == &rightPanelDrive
			&& strlen(leftPanelDrive.path) > 0)
		{
			selectedPanel = &leftPanelDrive;
			writeSelectorPosition(&leftPanelDrive, '>');
			writeSelectorPosition(&rightPanelDrive, ' ');
			writeCurrentFilename(selectedPanel);
		}
		break;

	case KEY_SH_PLUS:
		enterDirectory(selectedPanel);
		break;
	case KEY_SH_MINUS:
	case CH_ESC:
		leaveDirectory(selectedPanel);
		break;
	//case 188: // C= C - Command Menu
	//	writeMenu(command);
	//	break;
	//case 182: // C= L - Left Menu
	//	writeMenu(left);
	//	break;
	//case 178: // C= R - Right Menu
	//	writeMenu(right);
	//	break;
	//case 187: // C= F - File Menu
	//	writeMenu(file);
	//	break;
	//case 185: // C= O - Options Menu
	//	writeMenu(options);
	//	break;
	case HK_REREAD_LEFT:
		rereadDrivePanel(left);
		break;
	case HK_REREAD_RIGHT:
		rereadDrivePanel(right);
		break;
	case HK_DRIVE_LEFT:
		writeDriveSelectionPanel(left);
		break;
	case HK_DRIVE_RIGHT:
		writeDriveSelectionPanel(right);
		break;
	case HK_SELECT_ALL:
		selectAllFiles(selectedPanel, true);
		break;
	case HK_DESELECT_ALL:
		selectAllFiles(selectedPanel, false);
		break;
	case KEY_F1:
		if(loadOverlay(1))
			writeHelpPanel();
		break;
	case KEY_F2:
		quit();
		break;
	case KEY_F5:
		if(loadOverlay(4))
			copyFiles();
		break;
	case HK_RENAME:
	case KEY_F6:
		if(loadOverlay(4))
			renameFile();
		break;
	case HK_DELETE:
	case KEY_F8:
		if(loadOverlay(4))
			deleteFiles();
		break;
	//case KEY_AT:
	//	inputCommand();
	//	break;
	case KEY_F7:
		if(loadOverlay(4))
			makeDirectory();
		break;
	case HK_TO_TOP:
		moveTop(selectedPanel);
		break;
	case HK_TO_BOTTOM:
		moveBottom(selectedPanel);
		break;
	case HK_PAGE_UP:
		movePageUp(selectedPanel);
		break;
	case HK_PAGE_DOWN:
		movePageDown(selectedPanel);
		break;
	case HK_WRITE_DISK_IMAGE:
		if(loadOverlay(3))
			writeDiskImage();
		break;
	case HK_CREATE_DISK_IMAGE:
		if(loadOverlay(3))
			createDiskImage();
		break;
	case HK_COPY_DISK:
		if(loadOverlay(2))
			copyDisk();
		break;
	default:
		//writeStatusBarf("%c", key);
		break;
	}
}
 // --------------------------------------
 ReferenceManager::~ReferenceManager()
 {
     deleteReferences();
     deleteFiles();
 }
Exemple #20
0
void processTerminalCommands(void){
    clearLCD();
   
    // if the user decided to Store info
    // to the USB drive.
    
    #ifdef StoreUSB
    // Check the logging flag,
    // if the logging flag is 1
    if(LoggingState && !ON){
        LoggingState = 0;
        
        //Stop Logging
        closeAllFiles();
        
        //Print to LCD
        goToLine(1);
        LCDprint("Stop logging");
    }
    
    // if the logging flag is 0
    if(!LoggingState && ON){
        LoggingState = 1;
        
        //Start Logging
        openNewFiles();
        
        //Print to LCD
        goToLine(1);
        LCDprint("Start logging");
    } 
    #endif
    
    #ifdef USB
    
    if(HOSTXbee.available() > 0){
        
        char readChar = HOSTXbee.read();
        
        // Options from Terminal:
        //  1 -> start Logging
        //  2 -> stop Logging
        //  3 -> silent Mode
        //       lights off but logging ON
        //  4 -> display files
        //  5 -> delete files
        //  6 -> directory listing
        //  7 -> suspend the VDIP
        //  8 -> set the VDIP to ASCII mode
        //  else -> Error in the input,
        //  Not a recognized input
        
        if(readChar == '1'){
            
            // Start Logging to USB
            goToLine(1);
            LCDprint("Started Logging");
            LoggingState = 1;
            ON = 1;
            
            openNewFiles();
            goToLine(2);
            LCDprint(">");
            
        }else if(readChar == '2'){
            
            // Stop Logging to USB
            goToLine(1);
            LCDprint("Stopped Logging");
            LoggingState = 0;
            ON = 0;
            
            closeAllFiles();
            
            goToLine(2);
            LCDprint(">");
            
        }else if(readChar == '3'){
            
            // Put in silent mode
            goToLine(1);
            LCDprint("Silent mode");
            turnOffBacklight();
            
            goToLine(2);
            LCDprint(">");
            
        }else if(readChar == '4'){
            
            goToLine(1);
            // Print File System
            LCDprint("Files are written to:");
           
            goToLine(2);
            LCDprint("~\\");        
            
            goToLine(3);
            LCDprint("TempData.CSV");
            
            goToLine(4);
            LCDprint("Vitals.CSV");
            
            goToLine(5);
            LCDprint("Others.CSV");
            
            goToLine(6);
            LCDprint("System.txt");
            
            goToLine(7);
            LCDprint("Acknowledge.txt");
            
            goToLine(8);
            LCDprint(">");
            
        }else if(readChar == '5'){
            
            // Delete files
            goToLine(1);
            LCDprint("Deleting files");
            deleteFiles();
            
            goToLine(2);
            LCDprint(">");
            
        }else if(readChar == '6'){
            
            // Show the directory
            goToLine(1);
            LCDprint("DIR:");
            
            goToLine(2);
            readLineFromVDIP();
            
            goToLine(3);
            LCDprint(">");

        }else if(readChar == '7'){
            
            // Suspend the VDIP
            goToLine(1);
            LCDprint("Suspending:");
            putInSuspendMode();
            
            goToLine(2);
            LCDprint(">");            
            
        }else if(readChar == '8'){

            // Set ASCII mode
            setToASCIIMode();
            
            goToLine(1);
            LCDprint("[OK]");
            
            goToLine(2);
            LCDprint("> ");
            
        }else{
            
            // Print Help Menu
            goToLine(1);
            LCDprint("Unrecognised command '");
            LCDprintChar(readChar);
            LCDprint("'");
            
            delay(1000);
            
            goToLine(1);
            LCDprint("1 - Start logging");
            
            goToLine(2);
            LCDprint("2 - Stop logging");
            
            goToLine(3);
            LCDprint("3 - Silent Mode");
            
            goToLine(4);
            LCDprint("4 - Display Logfiles");
            
            goToLine(5);
            LCDprint("5 - Delete Logfiles");
            
            goToLine(6);
            LCDprint("6 - Directory listing");
            
            goToLine(7);
            LCDprint("7 - Suspend VDIP");
            
            goToLine(8);
            LCDprint("8 - Set to ASCII mode");
            
            delay(1000);
            
            goToLine(1);
            LCDprint("> ");
        }
    }
    #else
    
    // Can't print to Serial since we are using the
    // XBee layer, and we can only send AT Commands.
    // Unless the XBee is in API mode we cannot send
    // Serial Commands directly to the Board...
    
    clearLCD();
    
    goToLine(1);
    LCDprint("***ERROR***");
    #endif
}