Пример #1
0
void Relation::printDebug(const QByteArray& _indent) { 
    QString indent = _indent;
    indent += "  ";
    kDebug(planDbg())<<indent<<"  Parent:"<<m_parent->name();
    kDebug(planDbg())<<indent<<"  Child:"<<m_child->name();
    kDebug(planDbg())<<indent<<"  Type:"<<m_type;
}
Пример #2
0
tristate ReportDesignView::storeData ( bool dontAsk ) {

    QDomDocument doc ( "pgz_kexireport" );
    QDomElement root = doc.createElement ( "report" );
    QDomElement conndata = srcsel->connectionData();

    if (conndata.isNull())
        kDebug(planDbg()) << "Null conn data!";
    
    root.appendChild ( _rd->document() );
    root.appendChild(conndata);
    doc.appendChild ( root );

    QString src  = doc.toString();
    kDebug(planDbg()) << src;

    DB::Connection *conn = MainWindowIface::global()->project()->dbConnection();

    if ( storeDataBlock ( src, "pgzreport_layout" ) ) {
        kDebug(planDbg()) << "Saved OK";
        setDirty ( false );
        return true;
    } else {
        kDebug(planDbg()) << "NOT Saved OK";
    }

    return false;
}
Пример #3
0
QAbstractItemDelegate *DocumentItemModel::createDelegate( int column, QWidget *parent ) const
{
    switch ( column ) {
        //case 0: return new KUrlDelegate( parent ); //???????
        case DocumentModel::Property_Type: { kDebug(planDbg())<< column; return new EnumDelegate( parent ); }
        case DocumentModel::Property_SendAs: { kDebug(planDbg())<< column; return new EnumDelegate( parent ); }
        default: break;
    }
    return 0;
}
WBSDefinitionPanel::WBSDefinitionPanel( Project &project, WBSDefinition &def, QWidget *p, const char *n)
    : QWidget(p),
      m_project( project ),
      m_def(def),
      selectedRow(-1)
{
    setObjectName(n);
    setupUi(this);
    
    projectCode->setText( m_def.projectCode() );
    projectSeparator->setText( m_def.projectSeparator() );
    QStringList codeList = m_def.codeList();
    kDebug(planDbg())<<codeList;
    defaultSeparator->setText(m_def.defaultSeparator());
    defaultCode->addItems(codeList);
    defaultCode->setCurrentIndex(m_def.defaultCodeIndex());
    defaultCode->setFocus();
    levelsTable->setItemDelegateForColumn(0, new ComboBoxDelegate(codeList, this));
    levelsGroup->setChecked(m_def.isLevelsDefEnabled());
    int i = 0;
    const QMap<int, WBSDefinition::CodeDef> &lev = m_def.levelsDef();
    levelsTable->setRowCount(lev.count());
    QStringList sl;
    kDebug(planDbg())<<"Map size="<<lev.count();
    QMap<int, WBSDefinition::CodeDef>::const_iterator it;
    for (it = lev.begin(); it != lev.end(); ++it) {
        sl << QString("%1").arg(it.key());
        QTableWidgetItem *item = new QTableWidgetItem();
        item->setData(Qt::DisplayRole, it.value().code);
        levelsTable->setItem(i, 0, item);
        item = new QTableWidgetItem();
        item->setText(it.value().separator);
        levelsTable->setItem(i, 1, item);
        i++;
    }
    levelsTable->setVerticalHeaderLabels(sl);
    //levelsTable->setColumnStretchable(0, true);
    slotLevelChanged(level->value());
    
    connect(projectCode, SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(projectSeparator, SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(defaultCode, SIGNAL(activated(int)), SLOT(slotChanged()));
    connect(defaultSeparator, SIGNAL(textChanged(QString)), SLOT(slotChanged()));
    connect(levelsGroup, SIGNAL(toggled(bool)), SLOT(slotLevelsGroupToggled(bool)));
    connect(levelsTable, SIGNAL(cellChanged(int,int)), SLOT(slotChanged()));
    connect(levelsTable, SIGNAL(itemSelectionChanged()), SLOT(slotSelectionChanged()));
    connect(level, SIGNAL(valueChanged(int)), SLOT(slotLevelChanged(int)));
    connect(removeBtn, SIGNAL(clicked(bool)), SLOT(slotRemoveBtnClicked()));
    connect(addBtn, SIGNAL(clicked(bool)), SLOT(slotAddBtnClicked()));

    removeBtn->setEnabled(false);
}
QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
{
    kDebug(planDbg());
    QComboBox *editor = new KComboBox(parent);
    editor->installEventFilter(const_cast<ComboBoxDelegate*>(this));
    return editor;
}
Пример #6
0
StandardWorktimeDialogImpl::StandardWorktimeDialogImpl(StandardWorktime *std, QWidget *parent)
    : QWidget(parent),
      m_std(std) {
    
    setupUi(this);
    if (!std) {
        m_std = new StandardWorktime();
    }
    m_year = m_std->year();
    m_month = m_std->month();
    m_week = m_std->week();
    m_day = m_std->day();

    kDebug(planDbg())<<"y="<<m_year<<" m="<<m_month<<" w="<<m_week<<" d="<<m_day;
    year->setValue(m_year);
    month->setValue(m_month);
    week->setValue(m_week);
    day->setValue(m_day);
    
    connect(year, SIGNAL(valueChanged(double)), SLOT(slotYearChanged(double)));
    connect(month, SIGNAL(valueChanged(double)), SLOT(slotMonthChanged(double)));
    connect(week, SIGNAL(valueChanged(double)), SLOT(slotWeekChanged(double)));
    connect(day, SIGNAL(valueChanged(double)), SLOT(slotDayChanged(double)));

}
ResourceAppointmentsView::ResourceAppointmentsView(KoPart *part, KoDocument *doc, QWidget *parent)
    : ViewBase(part, doc, parent)
{
    kDebug(planDbg())<<"------------------- ResourceAppointmentsView -----------------------";

    setupGui();

    QVBoxLayout * l = new QVBoxLayout( this );
    l->setMargin( 0 );
    m_view = new ResourceAppointmentsTreeView( this );
    l->addWidget( m_view );

    m_view->setEditTriggers( m_view->editTriggers() | QAbstractItemView::EditKeyPressed );

    connect( model(), SIGNAL(executeCommand(KUndo2Command*)), doc, SLOT(addCommand(KUndo2Command*)) );

    connect( m_view, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentChanged(QModelIndex)) );

    connect( m_view, SIGNAL(selectionChanged(QModelIndexList)), this, SLOT(slotSelectionChanged(QModelIndexList)) );

    connect( m_view, SIGNAL(contextMenuRequested(QModelIndex,QPoint)), this, SLOT(slotContextMenuRequested(QModelIndex,QPoint)) );

    connect( m_view, SIGNAL(headerContextMenuRequested(QPoint)), SLOT(slotHeaderContextMenuRequested(QPoint)) );

}
Пример #8
0
void SpinBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
{
    kDebug(planDbg())<<editor<<":"<<option.rect<<","<<editor->sizeHint();
    QRect r = option.rect;
    //r.setHeight(r.height() + 50);
    editor->setGeometry(r);
}
Пример #9
0
void RequieredResourceDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
{
    kDebug(planDbg())<<editor<<":"<<option.rect<<","<<editor->sizeHint();
    QRect r = option.rect;
    r.setWidth( qMax( 100, r.width() ) );
    editor->setGeometry(r);
}
ComboBoxDelegate::ComboBoxDelegate(QStringList &list, QObject *parent)
    : QStyledItemDelegate(parent)
{
    kDebug(planDbg());
    setObjectName("ComboBoxDelegate");
    m_list = list;
}
void ResourceAppointmentsTreeView::saveContext( QDomElement &settings ) const
{
    kDebug(planDbg());
    QDomElement e = settings.ownerDocument().createElement( "common" );
    settings.appendChild( e );
    e.setAttribute( "show-internal-appointments", model()->showInternalAppointments() );
    e.setAttribute( "show-external-appointments", model()->showExternalAppointments() );
}
Пример #12
0
void AccountsTreeView::slotModelReset()
{
    hideColumns( m_leftview, QList<int>() << 3 << -1 );
    QHeaderView *v = m_leftview->header();
    kDebug(planDbg())<<v->sectionSize(2)<<v->sectionSizeHint(2)<<v->defaultSectionSize()<<v->minimumSectionSize();

    hideColumns( m_rightview, QList<int>() << 0 << 1 << 2 );
}
Пример #13
0
void AccountsView::slotHeaderContextMenuRequested( const QPoint &pos )
{
    kDebug(planDbg());
    QList<QAction*> lst = contextActionList();
    if ( ! lst.isEmpty() ) {
        QMenu::exec( lst, pos,  lst.first() );
    }
}
void ComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    QString value = index.model()->data(index, Qt::DisplayRole).toString();
    kDebug(planDbg())<<value<<":"<<m_list;
    QComboBox *comboBox = static_cast<QComboBox*>(editor);

    comboBox->insertItems(0, m_list);
    comboBox->setCurrentIndex(comboBox->findText(value));
}
Пример #15
0
void AccountsView::slotOptions()
{
    kDebug(planDbg());
    AccountsviewConfigDialog *dlg = new AccountsviewConfigDialog( this, m_view, this );
    connect(dlg, SIGNAL(finished(int)), SLOT(slotOptionsFinished(int)));
    dlg->show();
    dlg->raise();
    dlg->activateWindow();
}
void ResourceAppointmentsView::setGuiActive( bool activate )
{
    kDebug(planDbg())<<activate;
    updateActionsEnabled( true );
    ViewBase::setGuiActive( activate );
    if ( activate && !m_view->selectionModel()->currentIndex().isValid() ) {
        m_view->selectionModel()->setCurrentIndex(m_view->model()->index( 0, 0 ), QItemSelectionModel::NoUpdate);
    }
}
Пример #17
0
// reimp
void SplitterView::setGuiActive( bool active ) // virtual slot
{
    kDebug(planDbg())<<active<<m_activeview;
    if ( m_activeview ) {
        m_activeview->setGuiActive( active );
    } else {
        emit guiActivated( this, active );
    }
}
Пример #18
0
void WorkPackageProxyModel::sourceModelReset()
{
//    kDebug(planDbg());
    attachTasks();
    for ( int r = 0; r < rowCount(); ++r ) {
        kDebug(planDbg())<<index( r, 0 ).data();
    }
    endResetModel();
}
void ResourceAppointmentsView::slotOptions()
{
    kDebug(planDbg());
    ResourceAppointmentsSettingsDialog *dlg = new ResourceAppointmentsSettingsDialog( this, m_view->model(), this );
    connect(dlg, SIGNAL(finished(int)), SLOT(slotOptionsFinished(int)));
    dlg->show();
    dlg->raise();
    dlg->activateWindow();
}
Пример #20
0
tristate ReportDesignView::beforeSwitchTo ( ::ViewMode mode, bool &dontStore ) {
    kDebug(planDbg()) << mode;
    dontStore = true;
    if ( _rd && mode == ::DataViewMode ) {
        tempData()->reportDefinition = _rd->document();
        tempData()->reportSchemaChangedInPreviousView = true;
    }
    return true;
}
void WBSDefinitionPanel::slotRemoveBtnClicked() {
    kDebug(planDbg())<<selectedRow;
    if (selectedRow == -1) {
        return;
    }
    levelsTable->removeRow(selectedRow);
    removeBtn->setEnabled(false);
    slotLevelChanged(level->value());
}
bool ResourceAppointmentsTreeView::loadContext( const KoXmlElement &context )
{
    kDebug(planDbg());
    KoXmlElement e = context.namedItem( "common" ).toElement();
    if ( ! e.isNull() ) {
        model()->setShowInternalAppointments( (bool)( e.attribute( "show-internal-appointments", "0" ).toInt() ) );
        model()->setShowExternalAppointments( (bool)( e.attribute( "show-external-appointments", "0" ).toInt() ) );
    }
    return true;
}
Пример #23
0
ViewBase *SplitterView::findView( const QPoint &pos ) const
{
    for ( int i = 0; i < m_splitter->count(); ++i ) {
        ViewBase *w = dynamic_cast<ViewBase*>( m_splitter->widget( i ) );
        if ( w && w->frameGeometry().contains( pos ) ) {
            kDebug(planDbg())<<pos<<" in "<<w->frameGeometry();
            return w;
        }
        QTabWidget *tw = dynamic_cast<QTabWidget*>( m_splitter->widget( i ) );
        if (tw && tw->frameGeometry().contains( pos ) ) {
            w = dynamic_cast<ViewBase*>( tw->currentWidget() );
            if ( w ) {
                kDebug(planDbg())<<pos<<" in "<<w->frameGeometry();
                return w;
            }
        }
    }
    return const_cast<SplitterView*>( this );
}
Пример #24
0
void GanttPrintingDialog::printPage( int page, QPainter &painter )
{
    kDebug(planDbg())<<"page:"<<page<<"first"<<documentFirstPage()<<"last:"<<documentLastPage();
    QRectF sourceRect = m_sceneRect;
    int p = page - documentFirstPage();
    QRectF pageRect = printer().pageRect();
    pageRect.moveTo( 0, 0 );
    bool singlePage = m_gantt->m_printOptions.singlePage;
    int vert = singlePage ? 0 : p / m_horPages;
    int hor = singlePage ? 0 : p % m_horPages;
    if ( ! singlePage && documentLastPage() > documentFirstPage() ) {
        // print on multiple pages, so calculate rects to print
        qreal hh = vert == 0 ? m_headerHeight : 0;
        qreal ho = vert > 0 ? m_headerHeight : 0;
        sourceRect = QRectF( sourceRect.x() + ( pageRect.width() * hor ), sourceRect.y() + ( ( pageRect.height() * vert ) - ho ), pageRect.width(), pageRect.height() - hh );
        kDebug(planDbg())<<p<<hor<<vert<<sourceRect;
    }
    painter.setClipRect( pageRect.adjusted( -1.0, -1.0, 1.0, 1.0 ) );
    // QT5TODO
//     m_gantt->print( &painter, pageRect, sourceRect, hor == 0 && m_gantt->m_printOptions.printRowLabels, vert == 0 );
}
Пример #25
0
 foreach ( NodeMap *l, m_top ) {
     int c = l->count();
     if ( c > 0 ) {
         //FIXME: gives error msg:
         // Can't select indexes from different model or with different parents
         QModelIndex i = index( l );
         kDebug(planDbg())<<i<<0<<c-1;
         beginRemoveRows( i, 0, c-1 );
         l->clear();
         endRemoveRows();
     }
 }
Пример #26
0
void WorkPackageProxyModel::sourceRowsRemoved(const QModelIndex &parent, int start, int end)
{
    kDebug(planDbg())<<parent<<start<<end;
    Q_ASSERT( ! parent.isValid() );
    for ( int r = start; r <= end; ++r ) {
        QModelIndex i = index( r, 0 );
        Task *task = taskFromIndex( i );
        if ( task ) {
            detachTasks( task );
        }
    }
    endInsertRows();
}
void WBSDefinitionPanel::slotSelectionChanged() {
    QString s;
    selectedRow = -1;
    QList<QTableWidgetItem *> items = levelsTable->selectedItems();
    if (items.count() == 2 && items[0]->row() == items[1]->row()) {
        selectedRow = items[0]->row();
        s = QString("Row[%1]=selected ").arg(selectedRow);
    } else {
        s = "None selected";
    }
    removeBtn->setEnabled(selectedRow != -1);
    kDebug(planDbg())<<s;
}
Пример #28
0
void SplitterView::slotGuiActivated( ViewBase *v, bool active )
{
    kDebug(planDbg())<<active<<m_activeview<<" -> "<<v;
    if ( active ) {
        if ( m_activeview ) {
            emit guiActivated( m_activeview, false );
        }
        m_activeview = v;
    } else {
        m_activeview = 0;
    }
    emit guiActivated( v, active );
}
Пример #29
0
bool Relation::load(KoXmlElement &element, Project &project) {
    m_parent = project.findNode(element.attribute("parent-id"));
    if (m_parent == 0) {
        return false;
    }
    m_child = project.findNode(element.attribute("child-id"));
    if (m_child == 0) {
        return false;
    }
    if (m_child == m_parent) {
        kDebug(planDbg())<<"child == parent";
        return false;
    }
    if (m_child == m_parent) {
        kDebug(planDbg())<<"child == parent";
        return false;
    }
    if (!m_parent->legalToLink(m_child))
        return false;
        
    setType( element.attribute("type") );

    m_lag = Duration::fromString(element.attribute("lag"));

    if (!m_parent->addDependChildNode(this)) {
        kError()<<"Failed to add relation: Child="<<m_child->name()<<" parent="<<m_parent->name()<<endl;
        return false;
    }
    if (!m_child->addDependParentNode(this)) {
        m_parent->takeDependChildNode(this);
        kError()<<"Failed to add relation: Child="<<m_child->name()<<" parent="<<m_parent->name()<<endl;
        return false;
    }

    //kDebug(planDbg())<<"Added relation: Child="<<m_child->name()<<" parent="<<m_parent->name();
    return true;
}
Пример #30
0
bool PlanTJScheduler::solve()
{
    kDebug(planDbg())<<"PlanTJScheduler::solve()";
    TJ::Scenario *sc = m_tjProject->getScenario( 0 );
    if ( ! sc ) {
        if ( locale() ) {
            logError( m_project, 0, i18nc( "@info/plain" , "Failed to find scenario to schedule" ) );
        }
        return false;
    }
    DebugCtrl.setDebugLevel(0);
    DebugCtrl.setDebugMode(PSDEBUG+TSDEBUG+RSDEBUG+PADEBUG);

    return m_tjProject->scheduleScenario( sc );
}