Exemplo n.º 1
0
tristate KexiReportDesignView::afterSwitchFrom(Kexi::ViewMode mode)
{
    kDebug() << tempData()->document;
    if (tempData()->document.isEmpty()) {
        _rd = new ReportDesigner(this, KexiMainWindowIface::global()->project()->dbConnection());
    } else {
        if (_rd) {
            scr->takeWidget();
            delete _rd;
            _rd = 0;

        }
        _rd = new ReportDesigner(this, KexiMainWindowIface::global()->project()->dbConnection(), tempData()->document);
    }

    scr->setWidget(_rd);

    //plugSharedAction ( "edit_copy", _rd, SLOT ( slotEditCopy() ) );
    //plugSharedAction ( "edit_cut", _rd, SLOT ( slotEditCut() ) );
    //plugSharedAction ( "edit_paste", _rd, SLOT ( slotEditPaste() ) );
    //plugSharedAction ( "edit_delete", _rd, SLOT ( slotEditDelete() ) );

    connect(_rd, SIGNAL(propertySetChanged()), this, SLOT(slotDesignerPropertySetChanged()));
    connect(_rd, SIGNAL(dirty()), this, SLOT(setDirty()));

    //Edit Actions
    connect(editCutAction, SIGNAL(activated()), _rd, SLOT(slotEditCut()));
    connect(editCopyAction, SIGNAL(activated()), _rd, SLOT(slotEditCopy()));
    connect(editPasteAction, SIGNAL(activated()), _rd, SLOT(slotEditPaste()));
    connect(editDeleteAction, SIGNAL(activated()), _rd, SLOT(slotEditDelete()));

    connect(sectionEdit, SIGNAL(activated()), _rd, SLOT(slotSectionEditor()));

    //Control Actions
    connect(res->itemLabel, SIGNAL(clicked()), this, SLOT(slotLabel()));
    connect(res->itemField, SIGNAL(clicked()), this, SLOT(slotField()));
    connect(res->itemText, SIGNAL(clicked()), this, SLOT(slotText()));
    connect(res->itemLine, SIGNAL(clicked()), this, SLOT(slotLine()));
    connect(res->itemBarcode, SIGNAL(clicked()), this, SLOT(slotBarcode()));
    connect(res->itemChart, SIGNAL(clicked()),this, SLOT(slotChart()));
    connect(res->itemImage, SIGNAL(clicked()), this, SLOT(slotImage()));
    connect(res->itemShape, SIGNAL(clicked()), this, SLOT(slotShape()));
connect(res->itemCheck, SIGNAL(clicked()), this, SLOT(slotCheck()));

    //Raise/Lower
    connect(itemRaiseAction, SIGNAL(activated()), _rd, SLOT(slotRaiseSelected()));
    connect(itemLowerAction, SIGNAL(activated()), _rd, SLOT(slotLowerSelected()));
    return true;
}
Exemplo n.º 2
0
tristate KexiReportDesignView::afterSwitchFrom(Kexi::ViewMode mode)
{
    Q_UNUSED(mode);

    if (tempData()->reportDefinition.isNull()) {
        m_reportDesigner = new KoReportDesigner(this);
    } else {
        if (m_reportDesigner) {
            m_scrollArea->takeWidget();
            delete m_reportDesigner;
            m_reportDesigner = 0;
        }

        m_reportDesigner = new KoReportDesigner(this, tempData()->reportDefinition);
        m_sourceSelector->setConnectionData(tempData()->connectionDefinition);
    } 
    connect(m_reportDesigner, SIGNAL(itemInserted(QString)), this, SIGNAL(itemInserted(QString)));

    m_scrollArea->setWidget(m_reportDesigner);

    connect(m_reportDesigner, SIGNAL(propertySetChanged()), this, SLOT(slotDesignerPropertySetChanged()));
    connect(m_reportDesigner, SIGNAL(dirty()), this, SLOT(setDirty()));

    //Edit Actions
    connect(m_editCutAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditCut()));
    connect(m_editCopyAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditCopy()));
    connect(m_editPasteAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditPaste()));
    connect(m_editDeleteAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditDelete()));

    connect(m_sectionEdit, SIGNAL(activated()), m_reportDesigner, SLOT(slotSectionEditor()));

    //Raise/Lower
    connect(m_itemRaiseAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotRaiseSelected()));
    connect(m_itemLowerAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotLowerSelected()));
    return true;
}
Exemplo n.º 3
0
void VirtualConsole::initMenuBar()
{
    QString dir;
    _app->settings()->get(KEY_SYSTEM_DIR, dir);
    dir += QString("/") + PIXMAPPATH;

    setIcon(dir + QString("/virtualconsole.xpm"));

    m_layout = new QHBoxLayout(this);
    m_layout->setAutoAdd(false);

    m_menuBar = new QMenuBar(this);
    m_layout->setMenuBar(m_menuBar);

    //
    // Add menu
    //
    m_addMenu = new QPopupMenu();
    m_addMenu->insertItem(QPixmap(dir + "/button.xpm"),
                          "&Button", this, SLOT(slotAddButton()),
                          0, KVCMenuAddButton);
    m_addMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                          "&Slider", this, SLOT(slotAddSlider()),
                          0, KVCMenuAddSlider);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&Frame", this, SLOT(slotAddFrame()),
                          0, KVCMenuAddFrame);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&XY-Pad", this, SLOT(slotAddXYPad()),
                          0, KVCMenuAddXYPad);
    m_addMenu->setItemEnabled(KVCMenuAddXYPad, false);
    m_addMenu->insertItem(QPixmap(dir + "/rename.xpm"),
                          "L&abel", this, SLOT(slotAddLabel()),
                          0, KVCMenuAddLabel);

    //
    // Tools menu
    //
    m_toolsMenu = new QPopupMenu();
    m_toolsMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                            "&Settings...", this, SLOT(slotToolsSettings()),
                            0, KVCMenuToolsSettings);
    m_toolsMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                            "&Default Sliders", this, SLOT(slotToolsSliders()),
                            0, KVCMenuToolsSliders);
    m_toolsMenu->insertSeparator();
    m_toolsMenu->insertItem(QPixmap(dir + "/panic.xpm"),
                            "&Panic!", this, SLOT(slotToolsPanic()),
                            0, KVCMenuToolsPanic);


    //
    // Foreground menu
    //
    QPopupMenu* fgMenu = new QPopupMenu();
    fgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotForegroundColor()),
                       0, KVCMenuForegroundColor);
    fgMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                       "&Font...", this, SLOT(slotForegroundFont()),
                       0, KVCMenuForegroundFont);
    fgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotForegroundNone()),
                       0, KVCMenuForegroundNone);

    //
    // Background Menu
    //
    QPopupMenu* bgMenu = new QPopupMenu();
    bgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotBackgroundColor()),
                       0, KVCMenuBackgroundColor);
    bgMenu->insertItem(QPixmap(dir + QString("/image.xpm")),
                       "&Image...", this, SLOT(slotBackgroundImage()),
                       0, KVCMenuBackgroundPixmap);
    bgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotBackgroundNone()),
                       0, KVCMenuBackgroundNone);
    bgMenu->insertSeparator();
    bgMenu->insertItem(QPixmap(dir + QString("/frame.xpm")),
                       "Toggle &Frame", this, SLOT(slotBackgroundFrame()),
                       0, KVCMenuBackgroundFrame);

    //
    // Stacking order menu
    //
    QPopupMenu* stackMenu = new QPopupMenu();
    stackMenu->insertItem(QPixmap(dir + QString("/up.xpm")),
                          "&Raise", this, SLOT(slotStackingRaise()),
                          0, KVCMenuStackingRaise);
    stackMenu->insertItem(QPixmap(dir + QString("/down.xpm")),
                          "&Lower", this, SLOT(slotStackingLower()),
                          0, KVCMenuStackingLower);

    //
    // Edit menu
    //
    m_editMenu = new QPopupMenu();
    m_editMenu->insertItem(QPixmap(dir + "/editcut.xpm"),
                           "Cut", this, SLOT(slotEditCut()),
                           0, KVCMenuEditCut);

    m_editMenu->insertItem(QPixmap(dir + "/editcopy.xpm"),
                           "Copy", this, SLOT(slotEditCopy()),
                           0, KVCMenuEditCopy);

    m_editMenu->insertItem(QPixmap(dir + "/editpaste.xpm"),
                           "Paste", this, SLOT(slotEditPaste()),
                           0, KVCMenuEditPaste);

    m_editMenu->insertItem(QPixmap(dir + "/remove.xpm"),
                           "Delete", this, SLOT(slotEditDelete()),
                           0, KVCMenuEditDelete);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                           "&Properties...", this, SLOT(slotEditProperties()),
                           0, KVCMenuEditProperties);
    m_editMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                           "&Rename...", this, SLOT(slotEditRename()),
                           0, KVCMenuEditRename);

    m_editMenu->setItemEnabled(KVCMenuEditCut, false);
    m_editMenu->setItemEnabled(KVCMenuEditCopy, false);
    m_editMenu->setItemEnabled(KVCMenuEditPaste, false);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem("Foreground", fgMenu, KVCMenuForegroundMin);
    m_editMenu->insertItem("Background", bgMenu, KVCMenuBackgroundMin);
    m_editMenu->insertItem("Stacking Order", stackMenu, KVCMenuStackingMin);

    m_menuBar->insertItem("&Tools", m_toolsMenu);
    m_menuBar->insertItem("&Add", m_addMenu);
    m_menuBar->insertItem("&Edit", m_editMenu);
}
Exemplo n.º 4
0
tristate ReportDesignView::afterSwitchFrom ( ::ViewMode mode ) {
    kDebug(planDbg()) << tempData()->document;
    if ( tempData()->document.isEmpty() ) {
        _rd = new ReportDesigner ( this );
    } else {
        if ( _rd ) {
            scr->takeWidget();
            delete _rd;
            _rd = 0;
        }

        QDomDocument doc;
        doc.setContent ( tempData()->document );
        QDomElement root = doc.documentElement();
        QDomElement korep = root.firstChildElement( "koreport" );
        QDomElement conn = root.firstChildElement( "connection" );
        if ( !korep.isNull() ) {
            _rd = new ReportDesigner ( this, korep );
            if (!conn.isNull()) {
                srcsel->setConnectionData(conn);
            }
        } else {
            kDebug(planDbg()) << "no koreport section";

            //TODO remove...just create a blank document
            //Temp - allow load old style report definitions (no data)
            root.setTagName("koreport");
            _rd = new ReportDesigner ( this, root );
        }
    }

    scr->setWidget ( _rd );

    //plugSharedAction ( "edit_copy", _rd, SLOT(slotEditCopy()) );
    //plugSharedAction ( "edit_cut", _rd, SLOT(slotEditCut()) );
    //plugSharedAction ( "edit_paste", _rd, SLOT(slotEditPaste()) );
    //plugSharedAction ( "edit_delete", _rd, SLOT(slotEditDelete()) );

    connect ( _rd, SIGNAL(propertySetChanged()), this, SLOT(slotDesignerPropertySetChanged()) );
    connect ( _rd, SIGNAL(dirty()), this, SLOT(setDirty()) );

    //Edit Actions
    connect ( editCutAction, SIGNAL(activated()), _rd, SLOT(slotEditCut()) );
    connect ( editCopyAction, SIGNAL(activated()), _rd, SLOT(slotEditCopy()) );
    connect ( editPasteAction, SIGNAL(activated()), _rd, SLOT(slotEditPaste()) );
    connect ( editDeleteAction, SIGNAL(activated()), _rd, SLOT(slotEditDelete()) );

    connect ( sectionEdit, SIGNAL(activated()), _rd, SLOT(slotSectionEditor()) );

    //Control Actions
    connect ( res->itemLabel, SIGNAL(clicked()), this, SLOT(slotLabel()) );
    connect ( res->itemField, SIGNAL(clicked()), this, SLOT(slotField()) );
    connect ( res->itemText, SIGNAL(clicked()), this, SLOT(slotText()) );
    connect ( res->itemLine, SIGNAL(clicked()), this, SLOT(slotLine()) );
    connect ( res->itemBarcode, SIGNAL(clicked()), this, SLOT(slotBarcode()) );
    connect ( res->itemChart, SIGNAL(clicked()),this, SLOT(slotChart()) );
    connect ( res->itemImage, SIGNAL(clicked()), this, SLOT(slotImage()) );
    connect ( res->itemShape, SIGNAL(clicked()), this, SLOT(slotShape()) );
    connect ( res->itemCheck, SIGNAL(clicked()), this, SLOT(slotCheck()) );

    //Raise/Lower
    connect ( itemRaiseAction, SIGNAL(activated()), _rd, SLOT(slotRaiseSelected()) );
    connect ( itemLowerAction, SIGNAL(activated()), _rd, SLOT(slotLowerSelected()) );
    return true;
}