示例#1
0
void QImageDocumentSelectorDialog::init()
{
    setWindowTitle( tr( "Select Image" ) );
    QVBoxLayout *vb = new QVBoxLayout( this );
    vb->setContentsMargins(0, 0, 0, 0);

    connect( selector, SIGNAL(documentSelected(QContent)), this, SLOT(accept()) );
    connect( selector, SIGNAL(documentsChanged()), this, SLOT(setContextBar()) );

    vb->addWidget( selector );

    // Set thumbnail view
    selector->setViewMode( QImageDocumentSelector::Thumbnail );

    QAction *viewAction = new QAction( QIcon( ":icon/view" ), tr( "View" ), this );
    connect( viewAction, SIGNAL(triggered()), this, SLOT(viewImage()) );
    QMenu *menu = QSoftMenuBar::menuFor( selector );
    menu->actions().count() ? menu->insertAction(menu->actions().at(0), viewAction)
    : menu->addAction(viewAction);
    QSoftMenuBar::addMenuTo( this, menu );

    setContextBar();

    setModal( true );
    QtopiaApplication::setMenuLike( this, true );
}
示例#2
0
/*!
  Construct an image document selector widget with the given \a parent.
*/
QImageDocumentSelector::QImageDocumentSelector( QWidget* parent )
    : QWidget( parent )
{
    QVBoxLayout *layout = new QVBoxLayout( this );
    layout->setMargin( 0 );
    layout->setSpacing( 0 );

    d = new QImageDocumentSelectorPrivate( this );
    layout->addWidget( d );

    connect( d, SIGNAL(documentSelected(QContent)),
             this, SIGNAL(documentSelected(QContent)) );
    connect( d, SIGNAL(documentHeld(QContent,QPoint)),
             this, SIGNAL(documentHeld(QContent,QPoint)) );

    connect( d, SIGNAL(documentsChanged()), this, SIGNAL(documentsChanged()) );

    setFocusProxy( d );

    QSoftMenuBar::addMenuTo( this, QSoftMenuBar::menuFor( d ) );
}
void DocumentPage::createFinalContent()
{
    qDebug() << __PRETTY_FUNCTION__;
    if (!pageIndicator) {
        pageIndicator = new PageIndicator(QString(), this);
    }

    if (documentUrn.isEmpty()) {
        documentUrn = TrackerUtils::Instance().urnFromUrl(QUrl::fromLocalFile(documentName));
    }
    TrackerUtils::Instance().updateContentAccessedProperty(documentUrn);
    if (!documentUrn.isEmpty() && !liveDocument) {
        liveDocument = TrackerUtils::Instance().createDocumentLiveUpdate(QUrl(documentName));
        if (liveDocument) {
            connect(liveDocument->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(documentsChanged(QModelIndex, QModelIndex)));
            connect(liveDocument->model(), SIGNAL(rowsRemoved (QModelIndex, int, int)), SIGNAL(documentCloseEvent()));
        }
    }