示例#1
0
void ResTable::menuEditAndQuit()
{
    if (m_detaildocnum >= 0) {
	emit editRequested(m_detaildoc);
        m_rclmain->fileExit();
    }
}
示例#2
0
void ResTable::setRclMain(RclMain *m, bool ismain) 
{
    m_rclmain = m;
    m_ismainres = ismain;

    // We allow single selection only in the main table because this
    // may have a mix of file-level docs and subdocs and multisave
    // only works for subdocs
    if (m_ismainres)
	tableView->setSelectionMode(QAbstractItemView::SingleSelection);
    else
	tableView->setSelectionMode(QAbstractItemView::ExtendedSelection);

    if (!m_ismainres) {
	connect(new QShortcut(closeKeySeq, this), SIGNAL (activated()), 
		this, SLOT (close()));
	connect(new QShortcut(quitKeySeq, this), SIGNAL (activated()), 
		m_rclmain, SLOT (fileExit()));
	connect(this, SIGNAL(previewRequested(Rcl::Doc)), 
		m_rclmain, SLOT(startPreview(Rcl::Doc)));
	connect(this, SIGNAL(docSaveToFileClicked(Rcl::Doc)), 
		m_rclmain, SLOT(saveDocToFile(Rcl::Doc)));
	connect(this, SIGNAL(editRequested(Rcl::Doc)), 
		m_rclmain, SLOT(startNativeViewer(Rcl::Doc)));
    }
}
示例#3
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent, Qt::WindowContextHelpButtonHint) {
	setupUi(this);

	actionAttach->setIcon(QIcon::fromTheme(QString::fromWCharArray(L"mail-attachment"), QIcon(QString::fromWCharArray(L":/icons/mail-attachment.svg"))));
	actionStopProcess->setIcon(QIcon::fromTheme(QString::fromWCharArray(L"media-playback-pause"), QIcon(QString::fromWCharArray(L":/icons/media-playback-pause.svg"))));

	connect(directSearchWidget, SIGNAL(saveCheatRequested(Cheat::TypedLocation)), tabCheats, SLOT(appendItem(Cheat::TypedLocation)));
	connect(ptrSearchWidget, SIGNAL(saveCheatRequested(Cheat::TypedLocation)), tabCheats, SLOT(appendItem(Cheat::TypedLocation)));

	process = new ProcessDialog(this);
	process->setModal(true);
	connect(theTrainer.get(), SIGNAL(attachedChanged(bool)), SLOT(attachedChanged(bool)));
	connect(theTrainer.get(), SIGNAL(error(Error::Type::t)), SLOT(error(Error::Type::t)));
	connect(theTrainer.get(), SIGNAL(stopChanged(bool)), actionStopProcess, SLOT(setChecked(bool)));

	connect(theTrainer.get(), SIGNAL(progressChanged(double)), SLOT(progressChanged(double)));
	connect(theTrainer.get(), SIGNAL(progressRestarted(LongOperation::t)), SLOT(progressRestarted(LongOperation::t)));
	statusBar()->setStyleSheet(QString::fromWCharArray(L"QStatusBar::item{border-style: none;}"));
	progressBar = new QProgressBar();
	progressBar->setStyleSheet(QString::fromWCharArray(L"background-color: rgba(0, 0, 0, 0); border-style: none; text-align: center;"));
	statusBar()->addPermanentWidget(progressBar);

	valueEditor = new ValueEditorWidget(this);
	connect(directSearchWidget, SIGNAL(editRequested(Number::Type::t, Misc::Address, QString)), valueEditor, SLOT(setup(Number::Type::t, Misc::Address, QString)));
	addDockWidget(Qt::RightDockWidgetArea, valueEditor);

	GuiApplication::restoreWindowState(QString::fromWCharArray(L"Main window"), this);
	setWindowTitle(QCoreApplication::applicationName());

	attachedChanged(false);
}
示例#4
0
void KexiBlobTableEdit::handleAction(const QString& actionName)
{
    if (actionName == "edit_paste") {
        d->menu->paste();
    } else if (actionName == "edit_cut") {
        emit editRequested();
        d->menu->cut();
    }
}
示例#5
0
void ResTable::menuPreviewParent()
{
    if (m_detaildocnum >= 0 && m_model &&  
	m_model->getDocSource().isNotNull()) {
	Rcl::Doc pdoc = ResultPopup::getParent(m_model->getDocSource(), 
					      m_detaildoc);
	if (pdoc.mimetype == "inode/directory") {
	    emit editRequested(pdoc);
	} else {
	    emit previewRequested(pdoc);
	}
    }
}
void KexiDateTableEdit::handleAction(const QString& actionName)
{
    const bool alreadyVisible = m_lineedit->isVisible();

    if (actionName == "edit_paste") {
        const QVariant newValue(m_formatter.fromString(qApp->clipboard()->text()));
        if (!alreadyVisible) { //paste as the entire text if the cell was not in edit mode
            emit editRequested();
            m_lineedit->clear();
        }
        setValueInInternalEditor(newValue);
    } else
        KexiInputTableEdit::handleAction(actionName);
}
示例#7
0
void KexiComboBoxTableEdit::handleAction(const QString& actionName)
{
    const bool alreadyVisible = m_lineedit->isVisible();

    if (actionName == "edit_paste") {
        if (!alreadyVisible) { //paste as the entire text if the cell was not in edit mode
            emit editRequested();
            m_lineedit->clear();
        }
//! @todo does not work with BLOBs!
        setValueInInternalEditor(qApp->clipboard()->text());
    } else
        KexiInputTableEdit::handleAction(actionName);
}
void KexiBoolTableEdit::handleAction(const QString& actionName)
{
    if (actionName == "edit_paste") {
        emit editRequested();
        bool ok;
        const int value = qApp->clipboard()->text(QClipboard::Clipboard).toInt(&ok);
        if (ok) {
            m_currentValue = (value == 0) ? QVariant(false) : QVariant(true);
        } else {
            m_currentValue = field()->isNotNull()
                             ? QVariant(0)/*0 instead of NULL - handle case when null is not allowed*/
                             : QVariant();
        }
        repaintRelatedCell();
    } else if (actionName == "edit_cut") {
        emit editRequested();
//! @todo handle defaultValue...
        m_currentValue = field()->isNotNull()
                         ? QVariant(0)/*0 instead of NULL - handle case when null is not allowed*/
                         : QVariant();
        handleCopyAction(KexiDataItemInterface::originalValue(), QVariant());
        repaintRelatedCell();
    }
}
示例#9
0
void ResTable::onDoubleClick(const QModelIndex& index)
{
    if (!m_model || m_model->getDocSource().isNull())
	return;
    Rcl::Doc doc;
    if (m_model->getDocSource()->getDoc(index.row(), doc)) {
	m_detail->clear();
	m_detaildocnum = index.row();
	m_detaildoc = doc;
        if (m_detaildocnum >= 0) 
            emit editRequested(m_detaildoc);
    } else {
	m_detaildocnum = -1;
    }
}
示例#10
0
void ResTable::menuEdit()
{
    if (m_detaildocnum >= 0) 
	emit editRequested(m_detaildoc);
}
示例#11
0
void ResTable::menuOpenParent()
{
    if (m_detaildocnum >= 0 && m_model && m_model->getDocSource().isNotNull())
	emit editRequested(
	    ResultPopup::getParent(m_model->getDocSource(), m_detaildoc));
}
示例#12
0
void ResTable::linkWasClicked(const QUrl &url)
{
    if (m_detaildocnum < 0) {
	return;
    }
    QString s = url.toString();
    const char *ascurl = s.toUtf8();
    LOGDEB(("ResTable::linkWasClicked: [%s]\n", ascurl));

    int i = atoi(ascurl+1) -1;
    int what = ascurl[0];
    switch (what) {
    // Open abstract/snippets window
    case 'A':
	if (m_detaildocnum >= 0)
	    emit(showSnippets(m_detaildoc));
	break;
    case 'D':
	{
	    vector<Rcl::Doc> dups;
	    if (m_detaildocnum >= 0 && m_rclmain && 
		m_model->getDocSource()->docDups(m_detaildoc, dups)) {
		m_rclmain->newDupsW(m_detaildoc, dups);
	    }
	}
    // Open parent folder
    case 'F':
    {
        emit editRequested(ResultPopup::getParent(RefCntr<DocSequence>(),
                                                  m_detaildoc));
    }
    break;

    case 'P': 
    case 'E': 
    {
	if (what == 'P')
	    emit docPreviewClicked(i, m_detaildoc, 0);
	else
	    emit editRequested(m_detaildoc);
    }
    break;

	// Run script. Link format Rnn|Script Name
    case 'R':
    {
	int bar = s.indexOf("|");
	if (bar == -1 || bar >= s.size()-1)
            break;
        string cmdname = qs2utf8s(s.right(s.size() - (bar + 1)));
        DesktopDb ddb(path_cat(theconfig->getConfDir(), "scripts"));
        DesktopDb::AppDef app;
        if (ddb.appByName(cmdname, app)) {
            QAction act(QString::fromUtf8(app.name.c_str()), this);
            QVariant v(QString::fromUtf8(app.command.c_str()));
            act.setData(v);
            menuOpenWith(&act);
        }
    }
    break;

    default: 
	LOGERR(("ResTable::linkWasClicked: bad link [%s]\n", ascurl));
	break;// ?? 
    }
}
示例#13
0
void KexiBlobTableEdit::signalEditRequested()
{
    d->setValueInternalEnabled = false;
    emit editRequested();
    d->setValueInternalEnabled = true;
}
示例#14
0
void KexiBlobTableEdit::slotUpdateActionsAvailabilityRequested(bool& valueIsNull, bool& valueIsReadOnly)
{
    emit editRequested();
    valueIsNull = this->valueIsNull();
    valueIsReadOnly = d->readOnly || isReadOnly();
}
void KexiComboBoxBase::createPopup(bool show)
{
    //kDebug() << show << field() << popup() << m_updatePopupSelectionOnShow;
    if (!field())
        return;
    m_insideCreatePopup = true;
    QWidget* thisWidget = dynamic_cast<QWidget*>(this);
    QWidget *widgetToFocus = internalEditor() ? internalEditor() : thisWidget;

    if (m_reinstantiatePopupOnShow) {
        QWidget *oldPopup = popup();
        setPopup(0);
        delete oldPopup;
    }

    if (!popup()) {
        setPopup(column() ? new KexiComboBoxPopup(thisWidget, *column())
                 : new KexiComboBoxPopup(thisWidget, *field()));
        QObject::connect(popup(), SIGNAL(rowAccepted(KexiDB::RecordData*,int)),
                         thisWidget, SLOT(slotRowAccepted(KexiDB::RecordData*,int)));
        QObject::connect(popup()->tableView(), SIGNAL(itemSelected(KexiDB::RecordData*)),
                         thisWidget, SLOT(slotItemSelected(KexiDB::RecordData*)));

        popup()->setFocusProxy(widgetToFocus);
        popup()->tableView()->setFocusProxy(widgetToFocus);
        popup()->installEventFilter(thisWidget);

        if (origValue().isNull())
            popup()->tableView()->clearSelection();
        else {
            popup()->tableView()->selectRow(0);
            popup()->tableView()->setHighlightedRecord(0);
        }
    }
    if (show && internalEditor() && !internalEditor()->isVisible())
        /*emit*/editRequested();

    QPoint posMappedToGlobal = mapFromParentToGlobal(thisWidget->pos());
    if (posMappedToGlobal != QPoint(-1, -1)) {
//! todo alter the position to fit the popup within screen boundaries
        popup()->hide();
        popup()->move(posMappedToGlobal + QPoint(0, thisWidget->height()));
        //kDebug() << "pos:" << posMappedToGlobal + QPoint(0, thisWidget->height());
        //to avoid flickering: first resize to 0-height, then show and resize back to prev. height
        const int w = popupWidthHint();
        popup()->resize(w, 0);
        if (show) {
            popup()->show();
            //kDebug(44010) << "SHOW!!!";
        }
        popup()->updateSize(w);
        if (m_updatePopupSelectionOnShow) {
            int rowToHighlight = -1;
            KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema();
            KexiTableViewData *relData = column() ? column()->relatedData() : 0;
            if (lookupFieldSchema) {
                rowToHighlight = rowToHighlightForLookupTable();
            } else if (relData) {
                (void)valueForString(origValue().toString(), &rowToHighlight, 0, 1);
            } else //enum hint
                rowToHighlight = origValue().toInt();

            /*-->*/ m_moveCursorToEndInInternalEditor_enabled = show;
            m_selectAllInInternalEditor_enabled = show;
            m_setValueInInternalEditor_enabled = show;
            if (rowToHighlight == -1) {
                rowToHighlight = qMax(popup()->tableView()->highlightedRecord(), 0);
                setValueInInternalEditor(QVariant());
            }
            popup()->tableView()->selectRow(rowToHighlight);
            popup()->tableView()->setHighlightedRecord(rowToHighlight);
            if (rowToHighlight < popup()->tableView()->rowsPerPage())
                popup()->tableView()->ensureCellVisible(0, -1);

            /*-->*/ m_moveCursorToEndInInternalEditor_enabled = true;
            m_selectAllInInternalEditor_enabled = true;
            m_setValueInInternalEditor_enabled = true;
        }
    }

    if (show) {
        moveCursorToEndInInternalEditor();
        selectAllInInternalEditor();
        widgetToFocus->setFocus();
        popup()->show();
        popup()->raise();
        popup()->repaint();
    }
    m_insideCreatePopup = false;
}