예제 #1
0
void TodoView::updateView()
{
  clear();
  sortPriority();
  adjustColumns();
  repaint();
}
CookieExceptionsDialog::CookieExceptionsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CookieExceptionsDialog),
    m_cookieJar(0)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Sheet);
    connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(remove()));
    connect(ui->removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
    m_exceptionsModel = new CookieExceptionsModel(this);
    m_proxyModel = new QSortFilterProxyModel(this);
    m_proxyModel->setSourceModel(m_exceptionsModel);
    connect(ui->search, SIGNAL(textChanged(QString)),
            m_proxyModel, SLOT(setFilterFixedString(QString)));
    ui->exceptionTable->setModel(m_proxyModel);

    CookieModel *cookieModel = new CookieModel(this);
    ui->domainLineEdit->setCompleter(new QCompleter(cookieModel, ui->domainLineEdit));

    connect(ui->domainLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(textChanged(QString)));
    connect(ui->blockButton, SIGNAL(clicked()), this, SLOT(block()));
    connect(ui->allowButton, SIGNAL(clicked()), this, SLOT(allow()));
    connect(ui->allowForSessionButton, SIGNAL(clicked()), this, SLOT(allowForSession()));

    adjustColumns();
}
예제 #3
0
void TodoView::updateItem(int row, int col)
{
  QString tmpStr;
  int x=0, y=0;
  int id;

  updatingRow = row;

  ASSERT(row >= 0);
  editingFlag = TRUE;

  tmpStr = text(row, 0);
  id = atol(tmpStr.data());
  aTodo = calendar->getTodo(id);

  editor->hide();
  editor->setText(aTodo->getSummary());

  colXPos(col, &x);
  rowYPos(row, &y);
  y += 17; // correct for header size.

  // first, see if they clicked on the "done/not done column";
  if (col == 1) {
    tmpStr = text(row, 1);
    if (tmpStr == "CHECKED" || tmpStr == "CHECKEDMASK") {      
      aTodo->setStatus(QString("NEEDS ACTION"));
      changeItemPart("EMPTY", row, 1);
    } else {
      aTodo->setDtEnd(QDateTime::currentDateTime());
      aTodo->setStatus(QString("COMPLETED"));
      changeItemPart("CHECKED", row, 1);
    }
  }

  // see if they clicked on the "priority" column
  if (col == 2) {
    priList->move(x, y+2);
    priList->setCurrentItem(aTodo->getPriority()-1);
    priList->setFocus();
    priList->show();
  }

  // they clicked on the "description" column
  if (col == 3) {
    editor->move(x, y+2);
    editor->setFixedWidth(columnWidth(3));
    editor->setFixedHeight(cellHeight(row));
    editor->setFocus();
    editor->show();
  }
  if (col == 4) {
    // handle due date stuff
  }
  adjustColumns();
}
예제 #4
0
// this is an eventfilter for the KTabListBoxTable which holds all
// of the todo items.
bool TodoView::eventFilter(QObject *, QEvent *event)
{
  if (event->type() == Event_MouseButtonPress) {
    QMouseEvent *e = (QMouseEvent *) event;
    setUpdatesEnabled(FALSE);
    doMouseEvent(e);
    setUpdatesEnabled(TRUE);
    return TRUE;
  }
  if (event->type() == Event_Resize) {
      adjustColumns();
  }
  return FALSE;
}
예제 #5
0
void MouseConfig::changed(bool)
{
    QString res;
    int n = cmbButton->currentItem();
    if (n){
        if (chkAlt->isChecked()) n |= Qt::AltButton;
        if (chkCtrl->isChecked()) n |= Qt::ControlButton;
        if (chkShift->isChecked()) n |= Qt::ShiftButton;
        res = ShortcutsPlugin::buttonToString(n).c_str();
    }
    Q3ListViewItem *item = lstCmd->currentItem();
    if (item == NULL)
        return;
    item->setText(1, res);
    adjustColumns();
}
예제 #6
0
MainWindow::MainWindow(const QString &settingsDir, QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_model = new qbs::SettingsModel(settingsDir, this);
    ui->treeView->setModel(m_model);
    ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(ui->treeView, &QTreeView::expanded, this, &MainWindow::adjustColumns);
    connect(ui->treeView, &QWidget::customContextMenuRequested,
            this, &MainWindow::provideContextMenu);
    adjustColumns();

    QMenu * const fileMenu = menuBar()->addMenu(tr("&File"));
    QMenu * const viewMenu = menuBar()->addMenu(tr("&View"));

    QAction * const reloadAction = new QAction(tr("&Reload"), this);
    reloadAction->setShortcut(QKeySequence::Refresh);
    connect(reloadAction, &QAction::triggered, this, &MainWindow::reloadSettings);
    QAction * const saveAction = new QAction(tr("&Save"), this);
    saveAction->setShortcut(QKeySequence::Save);
    connect(saveAction, &QAction::triggered, this, &MainWindow::saveSettings);
    QAction * const expandAllAction = new QAction(tr("&Expand All"), this);
    expandAllAction->setShortcut(Qt::CTRL | Qt::Key_E);
    connect(expandAllAction, &QAction::triggered, this, &MainWindow::expandAll);
    QAction * const collapseAllAction = new QAction(tr("C&ollapse All"), this);
    collapseAllAction->setShortcut(Qt::CTRL | Qt::Key_O);
    connect(collapseAllAction, &QAction::triggered, this, &MainWindow::collapseAll);
    QAction * const exitAction = new QAction(tr("E&xit"), this);
    exitAction->setShortcut(QKeySequence::Quit);
    exitAction->setMenuRole(QAction::QuitRole);
    connect(exitAction, &QAction::triggered, this, &MainWindow::exit);

    fileMenu->addAction(reloadAction);
    fileMenu->addAction(saveAction);
    fileMenu->addSeparator();
    fileMenu->addAction(exitAction);

    viewMenu->addAction(expandAllAction);
    viewMenu->addAction(collapseAllAction);

    ui->treeView->installEventFilter(this);
}
예제 #7
0
void MainWindow::refreshFlags() {
    QString flagspace = this->flagsDock->flagspaceCombo->currentText();
    this->omnibar->clearFlags();
    if (flagspace == "(all)")
        flagspace = "";

    this->flagsDock->flagsTreeWidget->clear();

    for (auto i: core->getList("flags", flagspace)) {
        QStringList a = i.split (",");
        if (a.length()>3) {
            appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], a[3]);
            this->omnibar->fillFlags(a[0]);
        }
        else if (a.length()>2) {
            appendRow(this->flagsDock->flagsTreeWidget, a[1], a[2], a[0], "");
            this->omnibar->fillFlags(a[0]);
        }
    }
    adjustColumns(this->flagsDock->flagsTreeWidget);
    // Set omnibar completer for flags and commands
    this->omnibar->setupCompleter();
}
예제 #8
0
MouseConfig::MouseConfig(QWidget *parent, ShortcutsPlugin *plugin)
        : MouseConfigBase(parent)
{
    m_plugin = plugin;
    lstCmd->setSorting(0);
    loadMenu(MenuMain);
    loadMenu(MenuGroup);
    loadMenu(MenuContact);
    adjustColumns();
    cmbButton->insertItem("");
    cmbButton->insertItem(i18n("Left click"));
    cmbButton->insertItem(i18n("Right click"));
    cmbButton->insertItem(i18n("Middle click"));
    cmbButton->insertItem(i18n("Left dblclick"));
    cmbButton->insertItem(i18n("Right dblclick"));
    cmbButton->insertItem(i18n("Middle dblclick"));
    selectionChanged();
    connect(lstCmd, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(cmbButton, SIGNAL(activated(int)), this, SLOT(buttonChanged(int)));
    connect(chkAlt, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
    connect(chkCtrl, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
    connect(chkShift, SIGNAL(toggled(bool)), this, SLOT(changed(bool)));
}
예제 #9
0
ShortcutsConfig::ShortcutsConfig(QWidget *parent, ShortcutsPlugin *plugin)
        : ShortcutsConfigBase(parent)
{
    m_plugin = plugin;
    lstKeys->setSorting(0);
    loadMenu(MenuMain, true);
    loadMenu(MenuGroup, false);
    loadMenu(MenuContact, false);
    loadMenu(MenuStatus, true);
    adjustColumns();
    selectionChanged();
    connect(lstKeys, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(edtKey, SIGNAL(changed()), this, SLOT(keyChanged()));
    connect(btnClear, SIGNAL(clicked()), this, SLOT(keyClear()));
    connect(chkGlobal, SIGNAL(toggled(bool)), this, SLOT(globalChanged(bool)));
    for (QObject *p = parent; p != NULL; p = p->parent()){
        if (!p->inherits("QTabWidget"))
            continue;
        QTabWidget *tab = static_cast<QTabWidget*>(p);
        mouse_cfg = new MouseConfig(tab, plugin);
        tab->addTab(mouse_cfg, i18n("Mouse"));
        break;
    }
}
예제 #10
0
void MainWindow::updateFrames() {
    if (core == NULL)
        return;

    static bool first_time = true;
    if (first_time) {
        setup_mem();
        this->add_output(" > Adding binary information to notepad");
        notepadDock->setText("# Binary information\n\n" + core->cmd("i") +
                             "\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n");
        //first_time = false;
    } else {
        refreshMem("");
    }

    refreshFlagspaces();

    auto spi = QAbstractItemView::ScrollPerItem;
    auto spp = QAbstractItemView::ScrollPerPixel;

    // TODO: make this configurable by the user?
    const bool use_scrollperpixel = true;
    if (use_scrollperpixel) {
        this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spp);
        this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spp);
        this->importsDock->importsTreeWidget->setVerticalScrollMode(spp);
        this->functionsDock->functionsTreeWidget->setVerticalScrollMode(spp);
        this->stringsDock->stringsTreeWidget->setVerticalScrollMode(spp);
        this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spp);
        this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spp);
        this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spp);
    } else {
        this->flagsDock->flagsTreeWidget->setVerticalScrollMode(spi);
        this->symbolsDock->symbolsTreeWidget->setVerticalScrollMode(spi);
        this->importsDock->importsTreeWidget->setVerticalScrollMode(spi);
        this->functionsDock->functionsTreeWidget->setVerticalScrollMode(spi);
        this->stringsDock->stringsTreeWidget->setVerticalScrollMode(spi);
        this->relocsDock->relocsTreeWidget->setVerticalScrollMode(spi);
        this->memoryDock->xreFromTreeWidget_2->setVerticalScrollMode(spi);
        this->memoryDock->xrefToTreeWidget_2->setVerticalScrollMode(spi);
    }

    this->functionsDock->fillFunctions();

    this->importsDock->fillImports();

    // FIXME, doesn't work bc it sorts strings, not numbers... sigh
    /*
      Use QListWidgetItem::setData() not the constructor to set your value. Then all will work like you expect it to work.

      int yourIntValue = 123456;
      QListWidgetItem *item = new QListWidgetItem;
      item->setData(Qt::DisplayRole, yourIntValue);
    */
    //this->importsDock->importsTreeWidget->sortByColumn(1, Qt::DescendingOrder);

    adjustColumns(this->importsDock->importsTreeWidget);

    this->relocsDock->relocsTreeWidget->clear();
    for (auto i: core->getList ("bin","relocs")) {
        QStringList pieces = i.split (",");
        if (pieces.length()==3)
            appendRow(this->relocsDock->relocsTreeWidget, pieces[0], pieces[1], pieces[2]);
    }
    adjustColumns(this->relocsDock->relocsTreeWidget);

    this->symbolsDock->fillSymbols();

    this->stringsDock->stringsTreeWidget->clear();
    for (auto i : core->getList ("bin", "strings")) {
        QStringList pieces = i.split (",");
        if (pieces.length () == 2)
            appendRow(this->stringsDock->stringsTreeWidget, pieces[0], pieces[1]);
    }
    adjustColumns(this->stringsDock->stringsTreeWidget);

    this->commentsDock->commentsTreeWidget->clear();
    QList<QList<QString>> comments = this->core->getComments();
    for (QList<QString> comment: comments) {
        /*
        QString name;
        //this->add_debug_output("Comment: " + comment[1] + ": " + comment[0]);
        RAnalFunction *fcn = this->core->functionAt(comment[1].toLongLong(0, 16));
        if (fcn != NULL) {
            name = fcn->name;
        } else {
            name = "";
        }
        */
        QString fcn_name = this->core->cmdFunctionAt(comment[1]);
        appendRow(this->commentsDock->commentsTreeWidget, comment[1], fcn_name, comment[0].remove('"'));
    }
    adjustColumns(this->commentsDock->commentsTreeWidget);

    // Add nested comments
    QMap<QString, QList<QList<QString>>> cmts = this->core->getNestedComments();
    for(auto cmt : cmts.keys()) {
        QTreeWidgetItem *item = new QTreeWidgetItem(this->commentsDock->nestedCommentsTreeWidget);
        item->setText(0, cmt);
        QList<QList<QString>> meow = cmts.value(cmt);
        for (int i = 0; i < meow.size(); ++i) {
            QList<QString> tmp = meow.at(i);
            QTreeWidgetItem *it = new QTreeWidgetItem();
            it->setText(0, tmp[1]);
            it->setText(1, tmp[0].remove('"'));
            item->addChild(it);
        }
        this->commentsDock->nestedCommentsTreeWidget->addTopLevelItem(item);
    }
    adjustColumns(this->commentsDock->nestedCommentsTreeWidget);

    // TODO: FIXME: Remove the check for first_time;
    if (first_time) {
        sectionsWidget->tree->clear();
        int row = 0;
        for (auto i: core->getList("bin","sections")) {
            QStringList a = i.split (",");
            if (a.length()>2) {
                // Fix to work with ARM bins
                //if (a[4].startsWith(".")) {
                if (a[4].contains(".")) {
                    QString addr = a[1];
                    QString addr_end = "0x0"+core->itoa(core->math(a[1]+"+"+a[2]));
                    QString size = QString::number(core->math(a[2]));
                    QString name = a[4];
                    this->sectionsWidget->fillSections(row, name, size, addr, addr_end);

                    // Used to select a color for the sections graph
                    if (row == 10) {
                        row = 0;
                    } else {
                        row++;
                    }
                }
            }
        }
        //adjustColumns(sectionsWidget->tree);
        sectionsWidget->adjustColumns();

        first_time = false;

        this->dashboardDock->updateContents();
    }
}
예제 #11
0
void MainWindow::collapseAll()
{
    ui->treeView->collapseAll();
    adjustColumns();
}
예제 #12
0
void MainWindow::expandAll()
{
    ui->treeView->expandAll();
    adjustColumns();
}
예제 #13
0
void ShortcutsConfig::resizeEvent(QResizeEvent *e)
{
    ShortcutsConfigBase::resizeEvent(e);
    adjustColumns();
}
예제 #14
0
void MouseConfig::resizeEvent(QResizeEvent *e)
{
    resizeEvent(e);
    adjustColumns();
}
예제 #15
0
TodoView::TodoView(CalObject *cal, QWidget *parent, const char *name)
    : KTabListBox(parent, name, 5)
{
  calendar = cal;
  // set up filter for events
  lbox.installEventFilter(this);
  // set up the widget to have 4 columns (one hidden), and
  // only a vertical scrollbar
  clearTableFlags(Tbl_hScrollBar);
  clearTableFlags(Tbl_autoHScrollBar);
  // BL: autoscrollbar in not working...
  setTableFlags(Tbl_hScrollBar);
  setAutoUpdate(TRUE);
  adjustColumns();
  // insert pictures for use to show a checked/not checked todo
  dict().insert("CHECKED", new QPixmap(Icon("checkedbox.xpm")));
  dict().insert("EMPTY", new QPixmap(Icon("emptybox.xpm")));
  dict().insert("CHECKEDMASK", new QPixmap(Icon("checkedbox-mask.xpm")));
  dict().insert("EMPTYMASK", new QPixmap(Icon("emptybox-mask.xpm")));

  // this is the thing that lets you edit the todo text.
  editor = new QLineEdit(this);
  editor->hide();
  connect(editor, SIGNAL(returnPressed()),
	  this, SLOT(updateSummary()));
  connect(editor, SIGNAL(returnPressed()),
	  editor, SLOT(hide()));
  connect(editor, SIGNAL(textChanged(const char *)),
	  this, SLOT(changeSummary(const char *)));
  
  connect(this, SIGNAL(selected(int, int)),
    	  this, SLOT(updateItem(int, int)));
  connect(this, SIGNAL(highlighted(int, int)),
	  this, SLOT(hiliteAction(int, int)));

  priList = new QListBox(this);
  priList->hide();
  priList->insertItem("1");
  priList->insertItem("2");
  priList->insertItem("3");
  priList->insertItem("4");
  priList->insertItem("5");
  priList->setFixedHeight(priList->itemHeight()*5+5);
  priList->setFixedWidth(priList->maxItemWidth()+5);
  connect(priList, SIGNAL(highlighted(int)),
	  priList, SLOT(hide()));
  connect(priList, SIGNAL(highlighted(int)),
	  this, SLOT(changePriority(int)));

  QPixmap pixmap;
  rmbMenu1 = new QPopupMenu;
  pixmap = Icon("checkedbox.xpm");
  rmbMenu1->insertItem(pixmap, i18n("New Todo"), this,
		       SLOT(newTodo()));
  pixmap = Icon("delete.xpm");
  rmbMenu1->insertItem(pixmap, i18n("Purge Completed "), this,
		       SLOT(purgeCompleted()));

  rmbMenu2 = new QPopupMenu;
  pixmap = Icon("checkedbox.xpm");
  rmbMenu2->insertItem(pixmap, i18n("New Todo"), this,
		     SLOT (newTodo()));
  rmbMenu2->insertItem(i18n("Edit Todo"), this,
		     SLOT (editTodo()));
  pixmap = Icon("delete.xpm");
  rmbMenu2->insertItem(pixmap, i18n("Delete Todo"), this,
		     SLOT (deleteTodo()));
  rmbMenu2->insertItem(i18n("Purge Completed "), this,
		       SLOT(purgeCompleted()));


  editingFlag = FALSE;
  connect(this, SIGNAL(headerClicked(int)), this, SLOT(headerAction(int)));
  updateConfig();
  prevRow = updatingRow = -1;
}