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;
}
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;
}
Example #3
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;
}