Exemplo n.º 1
0
void FMListView::keyPressEvent( QKeyEvent * event )
{
    QListView::keyPressEvent( event );
    if(( event->key() == Qt::Key_Up )||( event->key() == Qt::Key_Down )
        ||( event->key() == Qt::Key_Home ) || ( event->key() == Qt::Key_End )
        ||( event->key() == Qt::Key_PageDown )||( event->key() == Qt::Key_PageUp ))
    {
        //qDebug()<<"key up or down";
        emit keyUpOrDownPressed();
    }
}
Exemplo n.º 2
0
FMPanel::FMPanel( MainWindow* aMainW, bool aLeft, QWidget * parent, Qt::WindowFlags f) : QWidget( parent, f ), left(aLeft)
{
    //setup variables
    mainW = aMainW;
    lastClick = QTime::currentTime ();
    noDrive = false;
    driveJustLoaded = false;
    //setup layouts and lists
    wholeLayout = new QVBoxLayout();
    tab = new QTabWidget();
    blist = new bookmarkListView();
    blist->setSelectionMode( QAbstractItemView::NoSelection );
    blist->setEditTriggers( QAbstractItemView::NoEditTriggers );
#if !defined(QEFEM_MAEMO_DEV)
    hlist = new historyListView( left );
    hlist->setSelectionMode( QAbstractItemView::NoSelection );
    hlist->setEditTriggers( QAbstractItemView::NoEditTriggers );
#endif
    foundList = new QListWidget( this );
    foundList->setSelectionMode( QAbstractItemView::NoSelection );
    foundList->setEditTriggers( QAbstractItemView::NoEditTriggers );    
#if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX)
    dlist = new driveListView();
#endif    
    dirList = new FMListView();
#if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX)
    tab->addTab(dlist,"Drives");
#endif    
    tab->addTab(dirList,"Files");
#if !defined(QEFEM_MAEMO_DEV)
    tab->addTab(hlist,"History");
#endif
    tab->addTab(blist,"Bookmarks");
    tab->addTab(foundList,"Found");
#if defined(QEFEM_MAEMO_DEV) || defined(Q_OS_LINUX)
    tab->setCurrentIndex(0);
#else
    tab->setCurrentIndex(1);
#endif    
    pathEdit = new QLineEdit();
#if defined(QEFEM_MAEMO_DEV)
    pathEdit->setVisible( false );
#endif
    wholeLayout->setContentsMargins( 0, 0, 0, 0 );
    wholeLayout->setSpacing(0);
    wholeLayout->addWidget( tab );
    wholeLayout->addWidget( pathEdit );
    setLayout( wholeLayout );
    setVisible( true );
    setPathEditText( QDir::homePath());
    currentDir.clear();
    currentDir.append(QDir::homePath());
    currentFile.clear();
    currentFile.append(QDir::homePath());
#if !defined(QEFEM_MAEMO_DEV)
#if !defined(Q_OS_LINUX)
    //tab->setToolTip("Drive tab shows the drives. Files tab shows the files. History shows the last 128 visited directories. Bookmark tab shows bookmarks.");
#else
    //tab->setToolTip("Files tab shows the files. History shows the last 128 visited directories. Bookmark tab shows bookmarks.");
#endif
#endif
    //setup signals and slots
#if !defined(QEFEM_MAEMO_DEV) && !defined(Q_OS_LINUX)
    connect(dlist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( driveClicked( const QModelIndex & ) ));
    connect(dlist, SIGNAL(activated( const QModelIndex& )), this, SLOT( driveClicked( const QModelIndex & ) ));
    connect(hlist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) ));
    connect(hlist, SIGNAL(activated( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) ));
    connect(dirList, SIGNAL(clicked( const QModelIndex& )), this, SLOT( dirClicked( const QModelIndex & ) ));
    connect(dirList, SIGNAL(activated( const QModelIndex& )), this, SLOT( dirDoubleClicked( const QModelIndex & ) ));
    connect(dirList, SIGNAL(entered( const QModelIndex& )), this, SLOT( dirClicked( const QModelIndex & ) ));
#endif
    connect(blist, SIGNAL(clicked( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) ));
    connect(blist, SIGNAL(activated( const QModelIndex& )), this, SLOT( listClicked( const QModelIndex & ) ));
    connect(foundList, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT( foundListClicked( QListWidgetItem * ) ));
    connect(foundList, SIGNAL(itemClicked ( QListWidgetItem *)), this, SLOT( foundListClicked( QListWidgetItem * ) ));
    connect(pathEdit, SIGNAL(editingFinished()),this,SLOT( editFinished() ));
    connect(dirList, SIGNAL(keyUpOrDownPressed()),this,SLOT( highlightMoved() ));
    connect(dirList, SIGNAL(copyFiles(const QStringList&)),this,SLOT( copy(const QStringList& ) ));
    connect(dirList, SIGNAL(focusGained()),this,SLOT( listGotFocus() ));
    //connect(dirList->model(), SIGNAL( rowChange()),this,SLOT(rowsChanged()));
    connect(dirList, SIGNAL( rootPathChanged ( const QString& )),this, SLOT( rootChanged ( const QString& ) ));
    foundList->clear();
    foundList->addItem("Clear list");
}