Logo Search packages:      
Sourcecode: webissues version File versions  Download package

IssueView::IssueView ( QObject *  parent,
QWidget *  parentWidget 
)

Constructor.

Parameters:
parent The parent object.
parentWidget The parent widget of the view's main widget.

Definition at line 65 of file issueview.cpp.

References XmlUi::Client::action(), WebIssues::IconLoader::icon(), XmlUi::Client::loadXmlFile(), XmlUi::Client::setAction(), WebIssues::View::setMainWidget(), XmlUi::Client::setTitle(), and WebIssues::View::setViewerSizeHint().

                                                             : View( parent ),
    m_model( NULL ),
    m_findDialog( NULL ),
    m_gotoItemId( 0 )
{
    QAction* action;

    action = new QAction( IconLoader::icon( "file-reload" ), tr( "&Update Issue" ), this );
    action->setShortcut( QKeySequence::Refresh );
    connect( action, SIGNAL( triggered() ), this, SLOT( updateIssue() ) );
    setAction( "updateIssue", action );

    action = new QAction( IconLoader::icon( "comment" ), tr( "Add &Comment..." ), this );
    action->setShortcut( QKeySequence::New );
    connect( action, SIGNAL( triggered() ), this, SLOT( addComment() ) );
    setAction( "addComment", action );

    action = new QAction( IconLoader::icon( "file-attach" ), tr( "Add &Attachment..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( addAttachment() ) );
    setAction( "addAttachment", action );

    action = new QAction( IconLoader::icon( "edit-rename" ), tr( "&Rename Issue..." ), this );
    action->setShortcut( tr( "F2" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( editRename() ) );
    setAction( "editRename", action );

    action = new QAction( IconLoader::icon( "find" ), tr( "&Find..." ), this );
    action->setShortcut( QKeySequence::Find );
    connect( action, SIGNAL( triggered() ), this, SLOT( find() ) );
    setAction( "find", action );

    action = new QAction( IconLoader::icon( "find-next" ), tr( "Find &Next" ), this );
    action->setShortcut( QKeySequence::FindNext );
    connect( action, SIGNAL( triggered() ), this, SLOT( findNext() ) );
    setAction( "findNext", action );

    action = new QAction( IconLoader::icon( "find-previous" ), tr( "Find &Previous" ), this );
    action->setShortcut( QKeySequence::FindPrevious );
    connect( action, SIGNAL( triggered() ), this, SLOT( findPrevious() ) );
    setAction( "findPrevious", action );

    action = new QAction( IconLoader::icon( "configure-columns" ), tr( "C&onfigure Attributes..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( configureAttributes() ) );
    setAction( "configureAttributes", action );

    action = new QAction( IconLoader::icon( "find" ), tr( "Find Item..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( openLink() ) );
    setAction( "findItem", action );

    action = new QAction( IconLoader::icon( "file-open" ), tr( "Open Attachment" ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( openAttachment() ) );
    setAction( "openAttachment", action );

    action = new QAction( IconLoader::icon( "file-save-as" ), tr( "Save Attachment As..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( saveAttachment() ) );
    setAction( "saveAttachment", action );

    action = new QAction( IconLoader::icon( "mail-send" ), tr( "Send Email..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( openLink() ) );
    setAction( "sendEmail", action );

    action = new QAction( IconLoader::icon( "window-new" ), tr( "Open Link in Browser..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( openLink() ) );
    setAction( "openLink", action );

    action = new QAction( IconLoader::icon( "edit-copy" ), tr( "Copy Email Address" ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( copyLink() ) );
    setAction( "copyEmail", action );

    action = new QAction( IconLoader::icon( "edit-copy" ), tr( "Copy Link Address" ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( copyLink() ) );
    setAction( "copyLink", action );

    action = new QAction( IconLoader::icon( "edit-copy" ), tr( "&Copy" ), this );
    action->setShortcut( QKeySequence::Copy );
    connect( action, SIGNAL( triggered() ), this, SLOT( copy() ) );
    setAction( "editCopy", action );

    action = new QAction( tr( "Select &All" ), this );
    action->setShortcut( QKeySequence::SelectAll );
    connect( action, SIGNAL( triggered() ), this, SLOT( selectAll() ) );
    setAction( "editSelectAll", action );

    setTitle( "menuMain", tr( "&Issue" ) );
    setTitle( "menuEdit", tr( "&Edit" ) );

    loadXmlFile( ":/resources/issueview.xml" );

    m_tabWidget = new QTabWidget( parentWidget );

    connect( m_tabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( tabChanged( int ) ) );

    QWidget* issueTab = new QWidget( m_tabWidget );
    QVBoxLayout* issueLayout = new QVBoxLayout( issueTab );
    QHBoxLayout* nameLayout = new QHBoxLayout();
    issueLayout->addLayout( nameLayout );
    QHBoxLayout* groupsLayout = new QHBoxLayout();
    issueLayout->addLayout( groupsLayout );

    QLabel* nameLabel = new QLabel( tr( "&Name:" ), issueTab );
    nameLayout->addWidget( nameLabel );

    m_nameEdit = new PopEditBox( issueTab );
    nameLayout->addWidget( m_nameEdit );

    nameLabel->setBuddy( m_nameEdit );

    connect( m_nameEdit, SIGNAL( linkClicked( const QString& ) ), this, SLOT( linkClicked( const QString& ) ) );
    connect( m_nameEdit, SIGNAL( linkContextMenu( const QString&, const QPoint& ) ),
        this, SLOT( linkContextMenu( const QString&, const QPoint& ) ) );
    connect( m_nameEdit, SIGNAL( buttonClicked() ), this, SLOT( editRename() ) );

    QGroupBox* propertyGroup = new QGroupBox( tr( "Properties" ), issueTab );
    QVBoxLayout* propertyLayout = new QVBoxLayout( propertyGroup );
    propertyLayout->setMargin( 0 );

    QScrollArea* propertyScroll = new QScrollArea( propertyGroup );
    propertyScroll->setFrameStyle( QFrame::NoFrame );
    propertyScroll->setWidgetResizable( true );
    m_propertyPanel = new PropertyPanel( propertyScroll );
    propertyScroll->setWidget( m_propertyPanel );
    propertyLayout->addWidget( propertyScroll );
    groupsLayout->addWidget( propertyGroup, 2 );

    QGroupBox* attributeGroup = new QGroupBox( tr( "Attributes" ), issueTab );
    QVBoxLayout* attributeLayout = new QVBoxLayout( attributeGroup );
    attributeLayout->setMargin( 0 );

    QScrollArea* attributeScroll = new QScrollArea( attributeGroup );
    attributeScroll->setWidgetResizable( true );
    attributeScroll->setFrameStyle( QFrame::NoFrame );
    m_attributePanel = new PopEditPanel( attributeScroll );
    attributeScroll->setWidget( m_attributePanel );
    attributeLayout->addWidget( attributeScroll );
    groupsLayout->addWidget( attributeGroup, 3 );

    connect( m_attributePanel, SIGNAL( linkClicked( const QString& ) ), this, SLOT( linkClicked( const QString& ) ) );
    connect( m_attributePanel, SIGNAL( linkContextMenu( const QString&, const QPoint& ) ),
        this, SLOT( linkContextMenu( const QString&, const QPoint& ) ) );
    connect( m_attributePanel, SIGNAL( buttonClicked( int ) ), this, SLOT( setValue( int ) ) );

    QWidget* historyTab = new QWidget( m_tabWidget );
    QVBoxLayout* historyLayout = new QVBoxLayout( historyTab );
    historyLayout->setMargin( 0 );

    m_browser = new QTextBrowser( historyTab );
    m_browser->setContextMenuPolicy( Qt::CustomContextMenu );

    historyLayout->addWidget( m_browser );

    connect( m_browser, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( historyContextMenu( const QPoint& ) ) );
    connect( m_browser, SIGNAL( anchorClicked( const QUrl& ) ), this, SLOT( anchorClicked( const QUrl& ) ) );
    connect( m_browser, SIGNAL( selectionChanged() ), this, SLOT( updateActions() ) );

    QWidget* attachmentsTab = new QWidget( m_tabWidget );
    QVBoxLayout* attachmentsLayout = new QVBoxLayout( attachmentsTab );
    attachmentsLayout->setMargin( 0 );

    m_list = new QTreeView( attachmentsTab );
    m_list->setSortingEnabled( true );
    m_list->setRootIsDecorated( false );
    m_list->setContextMenuPolicy( Qt::CustomContextMenu );

    attachmentsLayout->addWidget( m_list );

    connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( attachmentsContextMenu( const QPoint& ) ) );
    connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ),
        this, SLOT( doubleClicked( const QModelIndex& ) ) );

    m_tabWidget->addTab( issueTab, IconLoader::icon( "issue-open" ), tr( "Issue Details" ) );
    m_tabWidget->addTab( historyTab, IconLoader::icon( "view-history" ), tr( "Issue History" ) );
    m_tabWidget->addTab( attachmentsTab, IconLoader::icon( "file-attach" ), tr( "Attachments" ) );

    setMainWidget( m_tabWidget );

    setViewerSizeHint( QSize( 700, 500 ) );
}


Generated by  Doxygen 1.6.0   Back to index