コード例 #1
0
ファイル: TreeCtrl.cpp プロジェクト: Wushaowei001/NAF
void TreeCtrl::handleReload(Root::Action & t)
{
	QTreeView* tv = wnd();
	ENABLED_IF( t, true );

	tv->reset();
	if( tv->model() )
		QMetaObject::invokeMethod( tv->model(), "reload" );
}
コード例 #2
0
ファイル: TreeCtrl.cpp プロジェクト: Wushaowei001/NAF
void TreeCtrl::handleCollapseAll(Root::Action & t)
{
	QTreeView* tv = wnd();
	ENABLED_IF( t, true );

	const int count = tv->model()->rowCount();
	for( int i = 0; i < count; i++ )
		expand( tv, tv->model()->index( i, 0 ), false );
}
コード例 #3
0
ファイル: TreeCtrl.cpp プロジェクト: Wushaowei001/NAF
void TreeCtrl::handleExpandAll(Root::Action & t)
{
	QTreeView* tv = wnd();
	ENABLED_IF( t, true );

	QApplication::setOverrideCursor( Qt::WaitCursor );
	const int count = tv->model()->rowCount();
	for( int i = 0; i < count; i++ )
		expand( tv, tv->model()->index( i, 0 ), true );
	QApplication::restoreOverrideCursor();
}
コード例 #4
0
void SatellitesConfigDialog::expandTreeView()
{
    QTreeView *treeView = m_configWidget->treeView;

    if( !treeView->model() ) {
        return;
    }

    // expand only branches with selected items
    treeView->expandAll();

    for ( int i = 0; i < treeView->model()->columnCount(); ++i ) {
        treeView->resizeColumnToContents( i );
    }
}
コード例 #5
0
ファイル: route.cpp プロジェクト: caribe/Fado-Sound-Suite
Route::Route(QWidget *parent, Core *core) : QSplitter(parent)
{
	this->core = core;

	// Machine tree

	QTreeView *routeTree = new QTreeView(this);
	routeTree->setModel(core->gearsTree);
	routeTree->model()->setHeaderData(0, Qt::Horizontal, tr("Machines"));
	connect(routeTree, SIGNAL(doubleClicked(QModelIndex)), SLOT(newMachine(QModelIndex)));

	// Editor

	routeScene = new QGraphicsScene(this);
	routeScene->setSceneRect(0, 0, 1440, 768);

	routeEditor = new QGraphicsView(routeScene, this);
	routeEditor->setRenderHints(QPainter::Antialiasing);
	routeEditor->centerOn(0, 0);

	extraline = new QGraphicsPathItem();
	extraline->hide();
	routeScene->addItem(extraline);

	// Layout

	addWidget(routeTree);
	addWidget(routeEditor);

	setStretchFactor(1, 1);

}
コード例 #6
0
			void PackagesDelegate::invalidateWidgetPositions ()
			{
				QTreeView *view = qobject_cast<QTreeView*> (parent ());
				QAbstractItemModel *model = view->model ();
				for (int i = 0, rows = model->rowCount ();
						i < rows; ++i)
					emit sizeHintChanged (model->index (i, 0));
			}
コード例 #7
0
void MainWindow::showPlaylistsContextMenu(QPoint point)
{
    QTreeView *playlists = (QTreeView*)ui->tvPlaylists;
    if(playlists->indexAt(point).isValid()) {
        QStandardItemModel *model = (QStandardItemModel*)playlists->model();
        QStandardItem *item = model->itemFromIndex(playlists->indexAt(point));
        int data = item->data(DATA_KEY_PLAYLIST).toInt();
        QList<QAction *> actions;
        QAction *action;

        switch(data) {
            case DATA_SEARCH:
                break;
            case DATA_EMPTY:
                action = new QAction(playlists);
                action->setText(tr("Add"));
                connect(action, SIGNAL(triggered()), this, SLOT(addPlaylist()));
                actions.append(action);
                break;
            case DATA_HISTORY:
                break;
            default:
                action = new QAction(playlists);
                action->setText(tr("Delete"));
                connect(action, SIGNAL(triggered()), this, SLOT(deletePlaylist()));
                actions.append(action);
                break;
        }
        if(actions.count() > 0)
        {
            point.setX(point.x()-10);
            point.setY(point.y()+30);
            QMenu::exec(actions, playlists->mapToGlobal(point));
        }
    }
}
コード例 #8
0
void TestGlobalSearch::testGlobalSearch()
{
    QString filename(QFile::decodeName(FILES_DATA_DIR "/TestGlobalSearch.kexi"));
    kDebug() << filename;
    NewArgs args(m_argv);
    args.vals[args.count - 1] = qstrdup(QFile::encodeName(filename).constData());

    KexiAboutData aboutData;
    aboutData.setProgramName(ki18n(metaObject()->className()));
    int result = KexiMainWindow::create(args.count, args.vals, aboutData);
    QVERIFY(kapp);
    QCOMPARE(result, 0);

    QLineEdit *lineEdit = kexiTester().widget<QLineEdit*>("globalSearch.lineEdit");
    QVERIFY(lineEdit);
    QTreeView *treeView = kexiTester().widget<QTreeView*>("globalSearch.treeView");
    QVERIFY(treeView);

    lineEdit->setFocus();
    // enter "cars", expect 4 completion items
    QTest::keyClicks(lineEdit, "cars");
    QVERIFY(treeView->isVisible());
    int globalSearchCompletionListRows = treeView->model()->rowCount();
    QCOMPARE(globalSearchCompletionListRows, 4);

    // add "x", expect no completion items and hidden list
    QTest::keyClicks(lineEdit, "x");
    QVERIFY(!treeView->isVisible());
    globalSearchCompletionListRows = treeView->model()->rowCount();
    QCOMPARE(globalSearchCompletionListRows, 0);

    // Escape should clear
    QTest::keyClick(lineEdit, Qt::Key_Escape,  Qt::NoModifier, GUI_DELAY);
    QVERIFY(lineEdit->text().isEmpty());

    QTest::keyClicks(lineEdit, "cars");
    QVERIFY(treeView->isVisible());
    treeView->setFocus();
    QTest::keyPress(treeView, Qt::Key_Down, Qt::NoModifier, GUI_DELAY);
    QTest::keyPress(treeView, Qt::Key_Down, Qt::NoModifier, GUI_DELAY);
    QTest::keyPress(treeView, Qt::Key_Down, Qt::NoModifier, GUI_DELAY);

    // 3rd row should be "cars" form
    QModelIndexList selectedIndices = treeView->selectionModel()->selectedRows();
    QCOMPARE(selectedIndices.count(), 1);
    QCOMPARE(treeView->model()->data(selectedIndices.first(), Qt::DisplayRole).toString(), QLatin1String("cars"));

    // check if proper entry of Project Navigator is selected
    QTest::keyPress(treeView, Qt::Key_Enter, Qt::NoModifier, GUI_DELAY);

    KexiProjectNavigator *projectNavigator = kexiTester().widget<KexiProjectNavigator*>("KexiProjectNavigator");
    QVERIFY(projectNavigator);
    KexiPart::Item* selectedPartItem = projectNavigator->selectedPartItem();
    QVERIFY(selectedPartItem);
    QCOMPARE(selectedPartItem->name(), QLatin1String("cars"));
    QCOMPARE(selectedPartItem->partClass(), QLatin1String("org.kexi-project.form"));

    if (m_goToEventLoop) {
        result = qApp->exec();
        QCOMPARE(result, 0);
    }
}
コード例 #9
0
/*
 * Called every time user positions mouse over package's treeview items
 */
bool TreeViewPackagesItemDelegate::helpEvent ( QHelpEvent *event, QAbstractItemView*,
    const QStyleOptionViewItem&, const QModelIndex &index )
{
  if (this->parent()->objectName() == "tvPackages")
  {
    QTreeView* tvPackages = qobject_cast<QTreeView*>(this->parent());
    QSortFilterProxyModel *sfp = qobject_cast<QSortFilterProxyModel*>(tvPackages->model());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(sfp->sourceModel());

    if (sim->rowCount() == 0) return false;

    QModelIndex ind = sfp->mapToSource(index);
    QStandardItem *si = sim->itemFromIndex(ind);

    if (si)
    {
      //If the user's mouse is not positioned above the name column, let's give him a little help...
      if (si->column() != ctn_PACKAGE_NAME_COLUMN)
      {
        QModelIndex miName = sim->index(si->row(), ctn_PACKAGE_NAME_COLUMN);
        si = sim->itemFromIndex(miName);
      }

      QPoint p;
      gPoint = tvPackages->mapToGlobal(event->pos());
      QFuture<QString> f;
      disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      f = QtConcurrent::run(showPackageInfo, si->text());
      g_fwToolTip.setFuture(f);
      connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
    }
    else return false;
  }
  else if (this->parent()->objectName() == "tvTransaction")
  {
    QTreeView* tvTransaction = qobject_cast<QTreeView*>(this->parent());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(tvTransaction->model());

    if (sim->rowCount() == 0) return false;

    QStandardItem *si = sim->itemFromIndex(index);

    if (si)
    {
      //If it's really a package in the Transaction treeview...
      QString pkgName=si->text();

      //We have to separate Repository from Package Name, first
      int slash = pkgName.indexOf("/");
      if (slash != -1)
      {
        pkgName = pkgName.mid(slash+1);
      }

      if (si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconInstallItem().pixmap(22, 22).toImage() ||
          si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconRemoveItem().pixmap(22, 22).toImage())
      {
        QStandardItemModel *modelPackages = MainWindow::returnMainWindow()->getModelPackages();
        QList<QStandardItem*> foundItems =
            modelPackages->findItems(pkgName, Qt::MatchExactly, ctn_PACKAGE_NAME_COLUMN);

        if (foundItems.count() > 0)
        {
          QStandardItem *siFound = foundItems.at(0);

          QPoint p;
          gPoint = tvTransaction->mapToGlobal(event->pos());
          QFuture<QString> f;
          disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
          f = QtConcurrent::run(showPackageInfo, siFound->text());
          g_fwToolTip.setFuture(f);
          connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
        }
      }
      else
      {
        QToolTip::hideText();
      }
    }
  }

  return true;
}
コード例 #10
0
/*
 * Called every time user positions mouse over package's treeview items
 */
bool TreeViewPackagesItemDelegate::helpEvent ( QHelpEvent *event, QAbstractItemView*,
    const QStyleOptionViewItem&, const QModelIndex &index )
{
  if (this->parent()->objectName() == "tvPackages")
  {
    QTreeView* tvPackages = qobject_cast<QTreeView*>(this->parent());
    PackageModel* sim = qobject_cast<PackageModel*>(tvPackages->model());
    if (sim == NULL || sim->getPackageCount() == 0) return false;

    const PackageRepository::PackageData*const si = sim->getData(index);

    if (si != NULL)
    {
      QPoint p;
      gPoint = tvPackages->mapToGlobal(event->pos());
      QFuture<QString> f;
      disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      f = QtConcurrent::run(showPackageInfo, si->name);
      g_fwToolTip.setFuture(f);
      connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
    }
    else return false;
  }
  else if (this->parent()->objectName() == "tvTransaction")
  {
    QTreeView* tvTransaction = qobject_cast<QTreeView*>(this->parent());
    QStandardItemModel *sim = qobject_cast<QStandardItemModel*>(tvTransaction->model());

    if (sim->rowCount() == 0) return false;

    QStandardItem *si = sim->itemFromIndex(index);

    if (si)
    {
      //If it's really a package in the Transaction treeview...
      QString pkgName=si->text();

      //We have to separate Repository from Package Name, first
      int slash = pkgName.indexOf("/");
      if (slash != -1)
      {
        pkgName = pkgName.mid(slash+1);
      }

      if (si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconInstallItem().pixmap(22, 22).toImage() ||
          si->icon().pixmap(22, 22).toImage() ==
          IconHelper::getIconRemoveItem().pixmap(22, 22).toImage())
      {
        gPoint = tvTransaction->mapToGlobal(event->pos());
        QFuture<QString> f;
        disconnect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
        f = QtConcurrent::run(showPackageInfo, pkgName);
        g_fwToolTip.setFuture(f);
        connect(&g_fwToolTip, SIGNAL(finished()), this, SLOT(execToolTip()));
      }
      else
      {
        QToolTip::hideText();
      }
    }
  }

  return true;
}
コード例 #11
0
/*
 * This Event method is called whenever the user presses a key
 */
void MainWindow::keyPressEvent(QKeyEvent* ke)
{
  if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
  {
    if (ui->tvPackages->hasFocus())
    {
      execKeyActionOnPackage(ectn_INSTALL);
    }
    //We are searching for AUR foreign packages...
    else if (isAURGroupSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL)
    {
      if (UnixCommand::getLinuxDistro() == ectn_KAOS) return;

      ui->twGroups->setEnabled(false);

      QFuture<QList<PackageListData> *> f;
      disconnect(&g_fwAUR, SIGNAL(finished()), this, SLOT(preBuildAURPackageList()));
      m_cic = new CPUIntensiveComputing();
      f = QtConcurrent::run(searchAURPackages, m_leFilterPackage->text());
      g_fwAUR.setFuture(f);
      connect(&g_fwAUR, SIGNAL(finished()), this, SLOT(preBuildAURPackageList()));
    }
    //We are searching for packages that own some file typed by user...
    else if (isSearchByFileSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL)
    {
      ui->twGroups->setEnabled(false);

      QFuture<QString> f;
      disconnect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile()));
      m_cic = new CPUIntensiveComputing();
      f = QtConcurrent::run(searchPacmanPackagesByFile, m_leFilterPackage->text());
      g_fwPackageOwnsFile.setFuture(f);
      connect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile()));
    }
    //We are probably inside 'Files' tab...
    else
    {
      QTreeView *tvPkgFileList =
          ui->twProperties->widget(ctn_TABINDEX_FILES)->findChild<QTreeView*>("tvPkgFileList");

      if(tvPkgFileList)
      {
        if(tvPkgFileList->hasFocus())
        {
          openFile();
        }
      }
    }
  }
  else if(ke->key() == Qt::Key_Escape)
  {
    if(m_leFilterPackage->hasFocus())
    {
      m_leFilterPackage->clear();
    }
  }
  else if(ke->key() == Qt::Key_Delete)
  {
    onPressDelete();
  }    
  else if(ke->key() == Qt::Key_1 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION);
  }
  else if(ke->key() == Qt::Key_2 && ke->modifiers() == Qt::AltModifier)
  {
    ui->twProperties->setCurrentIndex(ctn_TABINDEX_FILES);
    refreshTabFiles(false, true);
  }
  else if(ke->key() == Qt::Key_3 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_TRANSACTION);
  }
  else if(ke->key() == Qt::Key_4 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_OUTPUT);
  }
  else if(ke->key() == Qt::Key_5 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
  }
  else if(ke->key() == Qt::Key_6 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_HELPUSAGE);
  }
  else if(ke->key() == Qt::Key_F2)
  {
    if (isPackageTreeViewVisible())
    {
      if (!ui->tvPackages->hasFocus()) ui->tvPackages->setFocus();
    }
    else
    {
      maximizePropertiesTabWidget(false);
      if (!ui->tvPackages->hasFocus()) ui->tvPackages->setFocus();
    }
  }
  else if(ke->key() == Qt::Key_F4)
  {
    openTerminal();
  }
  else if(ke->key() == Qt::Key_F6)
  {
    openDirectory();
  }
  else if (ke->key() == Qt::Key_F10)
  {
    maximizePackagesTreeView(false);
  }
  else if (ke->key() == Qt::Key_F12)
  {
    maximizePropertiesTabWidget(false);
  }
  else if(ke->key() == Qt::Key_C && ke->modifiers() == Qt::ControlModifier)
  {
    copyFullPathToClipboard();
  }
  else if(ke->key() == Qt::Key_L && ke->modifiers() == Qt::ControlModifier)
  {
    m_leFilterPackage->setFocus();
    m_leFilterPackage->selectAll();
  }
  else if(ke->key() == Qt::Key_F && ke->modifiers() == Qt::ControlModifier)
  {
    if (m_commandExecuting != ectn_NONE) return;

    if (isPropertiesTabWidgetVisible() &&
        (ui->twProperties->currentIndex() == ctn_TABINDEX_INFORMATION ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_OUTPUT ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_NEWS ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_HELPUSAGE))
    {
      QTextBrowser *tb = ui->twProperties->currentWidget()->findChild<QTextBrowser*>("textBrowser");
      SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar");

      if (tb && tb->toPlainText().size() > 0 && searchBar)
      {
        if (searchBar) searchBar->show();
      }
    }
    else if (isPropertiesTabWidgetVisible() && ui->twProperties->currentIndex() == ctn_TABINDEX_FILES)
    {
      QTreeView *tb = ui->twProperties->currentWidget()->findChild<QTreeView*>("tvPkgFileList");
      SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar");

      if (tb && tb->model()->rowCount() > 0 && searchBar)
      {
        if (searchBar) searchBar->show();
      }
    }
  }
  else if(ke->key() == Qt::Key_D && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    //The user wants to know which packages have no description!
    showPackagesWithNoDescription();
  }
  else if(ke->key() == Qt::Key_G && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    //The user wants to go to "Display All groups"
    if (!isAllGroupsSelected())
    {
      ui->twGroups->setCurrentItem(m_AllGroupsItem);
    }
  }
  else if(ke->key() == Qt::Key_Y && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)
          && m_hasAURTool)
  {
    if (m_commandExecuting != ectn_NONE) return;

    //The user wants to use "AUR tool" to search for pkgs
    m_actionSwitchToAURTool->trigger();
    if (m_actionSwitchToAURTool->isChecked() && UnixCommand::getLinuxDistro() != ectn_KAOS)
    {
      m_leFilterPackage->setFocus();
    }
    else
    {
      ui->tvPackages->setFocus();
    }
  }
  else if(ke->key() == Qt::Key_C && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    if (m_commandExecuting == ectn_NONE)
    {
      doCleanCache(); //If we are not executing any command, let's clean the cache
    }
  }
  else if(ke->key() == Qt::Key_R && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    if (m_commandExecuting == ectn_NONE)
    {
      doRemovePacmanLockFile(); //If we are not executing any command, let's remove Pacman's lock file
    }
  } 
  else if(ke->key() == Qt::Key_S && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    gistSysInfo();
  }

  #if QT_VERSION >= 0x050300
  else if(ke->key() == Qt::Key_T && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)
          && m_initializationCompleted)
  {
    if (m_commandExecuting != ectn_NONE) return;

    QStringList terminals = Terminal::getListOfAvailableTerminals();

    if (terminals.count() > 2)
    {
      int index = terminals.indexOf(SettingsManager::getTerminal());
      int newIndex = selectTerminal(index);

      if (index != newIndex)
      {
        SettingsManager::setTerminal(terminals.at(newIndex));
      }
    }
  }
  #endif

  else ke->ignore();
}
コード例 #12
0
ファイル: mainwindow_events.cpp プロジェクト: aarnt/octoxbps
/*
 * This Event method is called whenever the user presses a key
 */
void MainWindow::keyPressEvent(QKeyEvent* ke)
{
  if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
  {
    //We are searching for AUR foreign packages...
    if (isRemoteSearchSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL)
    {
      if (m_leFilterPackage->text().size() < 2)
      {
        QMessageBox::information(this, StrConstants::getWarning(), StrConstants::getSearchStringIsShort(), QMessageBox::Ok);
        return;
      }

      //ui->twGroups->setEnabled(false);

      QFuture<QList<PackageListData> *> f;
      disconnect(&g_fwRemote, SIGNAL(finished()), this, SLOT(preBuildRemotePackageList()));
      m_cic = new CPUIntensiveComputing();
      f = QtConcurrent::run(searchRemotePackages, m_leFilterPackage->text());
      g_fwRemote.setFuture(f);
      connect(&g_fwRemote, SIGNAL(finished()), this, SLOT(preBuildRemotePackageList()));
    }
    //We are searching for packages that own some file typed by user...
    else if (isSearchByFileSelected() && m_leFilterPackage->hasFocus() && m_cic == NULL)
    {
      //ui->twGroups->setEnabled(false);

      QFuture<QString> f;
      disconnect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile()));
      m_cic = new CPUIntensiveComputing();
      f = QtConcurrent::run(searchPacmanPackagesByFile, m_leFilterPackage->text());
      g_fwPackageOwnsFile.setFuture(f);
      connect(&g_fwPackageOwnsFile, SIGNAL(finished()), this, SLOT(positionInPkgListSearchByFile()));
    }
    //We are probably inside 'Files' tab...
    else
    {
      QTreeView *tvPkgFileList =
          ui->twProperties->widget(ctn_TABINDEX_FILES)->findChild<QTreeView*>("tvPkgFileList");

      if(tvPkgFileList)
      {
        if(tvPkgFileList->hasFocus())
        {
          openFile();
        }
      }
    }
  }
  else if(ke->key() == Qt::Key_Escape)
  {
    if(m_leFilterPackage->hasFocus())
    {
      m_leFilterPackage->clear();
    }
  }
  else if(ke->key() == Qt::Key_Delete)
  {
    onPressDelete();
  }    
  else if(ke->key() == Qt::Key_1 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_INFORMATION);
  }
  else if(ke->key() == Qt::Key_2 && ke->modifiers() == Qt::AltModifier)
  {
    ui->twProperties->setCurrentIndex(ctn_TABINDEX_FILES);
    refreshTabFiles(false, true);
  }
  else if(ke->key() == Qt::Key_3 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_TRANSACTION);
  }
  else if(ke->key() == Qt::Key_4 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_OUTPUT);
  }
  else if(ke->key() == Qt::Key_5 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_NEWS);
  }
  else if(ke->key() == Qt::Key_6 && ke->modifiers() == Qt::AltModifier)
  {
    changeTabWidgetPropertiesIndex(ctn_TABINDEX_HELPUSAGE);
  }
  else if(ke->key() == Qt::Key_F4)
  {
    openTerminal();
  }
  /*else if(ke->key() == Qt::Key_F5)
  {
    metaBuildPackageList();
  }*/
  else if(ke->key() == Qt::Key_F6)
  {
    openDirectory();
  }
  else if (ke->key() == Qt::Key_F10)
  {
    maximizePackagesTreeView(false);
  }
  else if (ke->key() == Qt::Key_F12)
  {
    maximizePropertiesTabWidget(false);
  }
  else if(ke->key() == Qt::Key_C && ke->modifiers() == Qt::ControlModifier)
  {
    copyFullPathToClipboard();
  }
  else if(ke->key() == Qt::Key_L && ke->modifiers() == Qt::ControlModifier)
  {
    m_leFilterPackage->setFocus();
    m_leFilterPackage->selectAll();
  }
  else if(ke->key() == Qt::Key_F && ke->modifiers() == Qt::ControlModifier)
  {
    if (m_commandExecuting != ectn_NONE) return;

    if (isPropertiesTabWidgetVisible() &&
        (ui->twProperties->currentIndex() == ctn_TABINDEX_INFORMATION ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_OUTPUT ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_NEWS ||
         ui->twProperties->currentIndex() == ctn_TABINDEX_HELPUSAGE))
    {
      QTextBrowser *tb = ui->twProperties->currentWidget()->findChild<QTextBrowser*>("textBrowser");
      SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar");

      if (tb && tb->toPlainText().size() > 0 && searchBar)
      {
        if (searchBar) searchBar->show();
      }
    }
    else if (isPropertiesTabWidgetVisible() && ui->twProperties->currentIndex() == ctn_TABINDEX_FILES)
    {
      QTreeView *tb = ui->twProperties->currentWidget()->findChild<QTreeView*>("tvPkgFileList");
      SearchBar *searchBar = ui->twProperties->currentWidget()->findChild<SearchBar*>("searchbar");

      if (tb && tb->model()->rowCount() > 0 && searchBar)
      {
        if (searchBar) searchBar->show();
      }
    }
  }
  else if(ke->key() == Qt::Key_D && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    //The user wants to know which packages have no description!
    showPackagesWithNoDescription();
  }
  else if(ke->key() == Qt::Key_G && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    //The user wants to go to "Display All groups"
    if (!isAllCategoriesSelected())
    {
      ui->twGroups->setCurrentItem(m_AllGroupsItem);
    }
  }
  else if(ke->key() == Qt::Key_C && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    if (m_commandExecuting == ectn_NONE)
    {
      doCleanCache(); //If we are not executing any command, let's clean the cache
    }
  }
  else if(ke->key() == Qt::Key_R && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    if (m_commandExecuting == ectn_NONE)
    {
      doRemovePacmanLockFile(); //If we are not executing any command, let's remove Pacman's lock file
    }
  } 
  else if(ke->key() == Qt::Key_T && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier)
          && m_initializationCompleted)
  {   
    if (m_commandExecuting != ectn_NONE) return;

    QStringList terminals = Terminal::getListOfAvailableTerminals();

    if (terminals.count() > 2)
    {
      int index = terminals.indexOf(SettingsManager::getTerminal());
      int newIndex = selectTerminal(index);

      if (index != newIndex)
      {
        SettingsManager::setTerminal(terminals.at(newIndex));
      }
    }
  }

  /*else if(ke->key() == Qt::Key_Z && ke->modifiers() == (Qt::ShiftModifier|Qt::ControlModifier))
  {
    parseXBPSProcessOutput("Updating configuration file `/etc/skel/.bashrc");
  }*/

  else ke->ignore();
}