Example #1
0
void QtListModelAdaptorPrivate::_q_modelReset()
{
    // ### we may need to cache the number of items to handle this
    qWarning() << "_q_modelReset not implemented";
    hideContents();
    showContents();
}
Example #2
0
void EvaChatView::showFileNotification( const TQString & who, const TQString & filename,
                                        const int size, const unsigned int session, const bool isSend )
{
    TQString strSession = TQString::number(session);
    TQString picPath = "<img src = \"" + EvaMain::images->getIconFullPath("MSG_INFO") + "\">";
    TQString acceptLink = "<a href=\""+ protocolAccept + "_" + strSession + "\">" + i18n("Accept") + "</a>";
    TQString saveAsLink = "<a href=\""+ protocolSaveAs + "_" + strSession + "\">" + i18n("Save As") + "</a>";
    TQString rejectLink = "<a href=\""+ protocolCancel + "_" + strSession + "\">" + i18n("Reject") + "</a>";
    TQString cancelLink = "<a href=\""+ protocolCancel + "_" + strSession + "\">" + i18n("Cancel") + "</a>";
    TQString fileSize = (size<0x400)?(TQString::number(size) + "B"):
                        ((size<0x100000)?(TQString::number(size/0x400) + "KB") :
                         ((size<0x40000000)?(TQString::number(size/0x100000) + "MB"):
                          (TQString::number(size/0x40000000) + "GB") ) );
    TQString fileInfo = filename + "(" + fileSize + ")";
    TQString txt;
    if(isSend) {
        txt = i18n("Waiting for %1 accepting file \"%2\". Please wait or %3.")
              .arg(who).arg(fileInfo).arg(cancelLink);
    } else {
        txt = i18n("%1 wants to send you a file \"%2\", you can %3, %4 or %5.")
              .arg(who).arg(fileInfo).arg(acceptLink).arg(saveAsLink).arg(rejectLink);
    }
    TQString msg = wrapFontAttributes(TQt::gray, 9, false, false, false, txt);
    updateContents("&nbsp;" + picPath + "&nbsp;" + msg );
    showContents();
}
Example #3
0
void EvaChatView::showInfomation( const TQString & info )
{
    TQString picPath = "<img src = \"" + EvaMain::images->getIconFullPath("MSG_INFO") + "\">";
    TQString msg = wrapFontAttributes(TQt::gray, 9, false, false, false, info);
    updateContents("&nbsp;" + picPath + "&nbsp;" + msg );
    showContents();
}
Example #4
0
void EvaChatView::askResumeMode( const TQString filename, const unsigned int session )
{
    TQString strSession = TQString::number(session);
    TQString picPath = "<img src = \"" + EvaMain::images->getIconFullPath("MSG_INFO") + "\">";
    TQString resumeLink = "<a href=\""+ protocolResume + "_" + strSession + "\">" +
                          i18n("resume") + "</a>";
    TQString restartLink = "<a href=\""+ protocolNewOne + "_" + strSession + "\">" +
                           i18n("start") + "</a>";
    TQString txt = i18n("Cached information of \"%1\" has been found, you can %2 the last download or ignore the last cached download information and %3 a new download.").arg(filename).arg(resumeLink).arg(restartLink);

    TQString msg = wrapFontAttributes(TQt::gray, 9, false, false, false, txt);
    updateContents("&nbsp;" + picPath + "&nbsp;" + msg );
    showContents();
}
Example #5
0
/*----------------------------------------------------------------------*/
static void showContainer(int cnt)
{
    char str[80];

    if (cnt < 1 || cnt > header->containerMax) {
        sprintf(str, "Container number out of range. Between 1 and %d, please.", header->containerMax);
        output(str);
        return;
    }

    sprintf(str, "Container %d :", cnt);
    output(str);
    if (containers[cnt].owner != 0) {
        cnt = containers[cnt].owner;
        say(cnt);
        sprintf(str, "$iLocation: %d", where(cnt, TRUE));
        output(str);
    }
    showContents(cnt);
}
Example #6
0
/*----------------------------------------------------------------------*/
static void showInstance(int ins)
{
    char str[80];

    if (ins > header->instanceMax) {
        sprintf(str, "Instance code %d is out of range", ins);
        output(str);
        return;
    }

    output("The");
    say(ins);
    sprintf(str, "[%d]", ins);
    output(str);
    if (instances[ins].parent) {
        sprintf(str, "Isa %s[%d]", idOfClass(instances[ins].parent), instances[ins].parent);
        output(str);
    }

    if (!isA(ins, header->locationClassId) || (isA(ins, header->locationClassId) && admin[ins].location != 0)) {
        sprintf(str, "$iLocation: ");
        output(str);
        showInstanceLocation(ins, " ");
    }

    output("$iAttributes:");
    showAttributes(admin[ins].attributes);

    if (instances[ins].container)
        showContents(ins);

    if (isA(ins, header->actorClassId)) {
        if (admin[ins].script == 0)
            output("$iIs idle");
        else {
            sprintf(str, "$iExecuting script: %d, Step: %d", admin[ins].script, admin[ins].step);
            output(str);
        }
    }
}
Example #7
0
QT_BEGIN_NAMESPACE

MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
    : QMainWindow(parent)
    , m_bookmarkWidget(0)
    , m_filterCombo(0)
    , m_toolBarMenu(0)
    , m_cmdLine(cmdLine)
    , m_progressWidget(0)
    , m_qtDocInstaller(0)
    , m_connectedInitSignals(false)
{
    TRACE_OBJ

    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setDockOptions(dockOptions() | AllowNestedDocks);

    QString collectionFile;
    if (usesDefaultCollection()) {
        MainWindow::collectionFileDirectory(true);
        collectionFile = MainWindow::defaultHelpCollectionFileName();
    } else {
        collectionFile = cmdLine->collectionFile();
    }
    HelpEngineWrapper &helpEngineWrapper =
        HelpEngineWrapper::instance(collectionFile);
    BookmarkManager *bookMarkManager = BookmarkManager::instance();

    if (!initHelpDB(!cmdLine->collectionFileGiven())) {
        qDebug("Fatal error: Help engine initialization failed. "
            "Error message was: %s\nAssistant will now exit.",
            qPrintable(HelpEngineWrapper::instance().error()));
        std::exit(1);
    }

    m_centralWidget = new CentralWidget(this);
    setCentralWidget(m_centralWidget);

    m_indexWindow = new IndexWindow(this);
    QDockWidget *indexDock = new QDockWidget(tr("Index"), this);
    indexDock->setObjectName(QLatin1String("IndexWindow"));
    indexDock->setWidget(m_indexWindow);
    addDockWidget(Qt::LeftDockWidgetArea, indexDock);

    m_contentWindow = new ContentWindow;
    QDockWidget *contentDock = new QDockWidget(tr("Contents"), this);
    contentDock->setObjectName(QLatin1String("ContentWindow"));
    contentDock->setWidget(m_contentWindow);
    addDockWidget(Qt::LeftDockWidgetArea, contentDock);

    m_searchWindow = new SearchWidget(helpEngineWrapper.searchEngine());
    m_searchWindow->setFont(!helpEngineWrapper.usesBrowserFont() ? qApp->font()
        : helpEngineWrapper.browserFont());
    QDockWidget *searchDock = new QDockWidget(tr("Search"), this);
    searchDock->setObjectName(QLatin1String("SearchWindow"));
    searchDock->setWidget(m_searchWindow);
    addDockWidget(Qt::LeftDockWidgetArea, searchDock);

    QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
    bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
    bookmarkDock->setWidget(m_bookmarkWidget
        = bookMarkManager->bookmarkDockWidget());
    addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);

    QDockWidget *openPagesDock = new QDockWidget(tr("Open Pages"), this);
    openPagesDock->setObjectName(QLatin1String("Open Pages"));
    OpenPagesManager *openPagesManager
        = OpenPagesManager::createInstance(this, usesDefaultCollection(), m_cmdLine->url());
    openPagesDock->setWidget(openPagesManager->openPagesWidget());
    addDockWidget(Qt::LeftDockWidgetArea, openPagesDock);

    connect(m_centralWidget, SIGNAL(addBookmark(QString, QString)),
        bookMarkManager, SLOT(addBookmark(QString, QString)));
    connect(bookMarkManager, SIGNAL(escapePressed()), this,
            SLOT(activateCurrentCentralWidgetTab()));
    connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget,
            SLOT(setSource(QUrl)));
    connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)),
        openPagesManager, SLOT(createPage(QUrl)));

    QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine();
    connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
    connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));

    QString defWindowTitle = tr("Qt Assistant");
    setWindowTitle(defWindowTitle);

    setupActions();
    statusBar()->show();
    m_centralWidget->connectTabBar();

    setupFilterToolbar();
    setupAddressToolbar();

    const QString windowTitle = helpEngineWrapper.windowTitle();
    setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
    QByteArray iconArray = helpEngineWrapper.applicationIcon();
    if (iconArray.size() > 0) {
        QPixmap pix;
        pix.loadFromData(iconArray);
        QIcon appIcon(pix);
        qApp->setWindowIcon(appIcon);
    } else {
        QIcon appIcon(QLatin1String(":/trolltech/assistant/images/assistant-128.png"));
        qApp->setWindowIcon(appIcon);
    }

    QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar"));
    toolBar->setObjectName(QLatin1String("Bookmark Toolbar"));
    bookMarkManager->setBookmarksToolbar(toolBar);

    // Show the widget here, otherwise the restore geometry and state won't work
    // on x11.
    show();

    toolBar->hide();
    toolBarMenu()->addAction(toolBar->toggleViewAction());

    QByteArray ba(helpEngineWrapper.mainWindow());
    if (!ba.isEmpty())
        restoreState(ba);

    ba = helpEngineWrapper.mainWindowGeometry();
    if (!ba.isEmpty()) {
        restoreGeometry(ba);
    } else {
        tabifyDockWidget(contentDock, indexDock);
        tabifyDockWidget(indexDock, bookmarkDock);
        tabifyDockWidget(bookmarkDock, searchDock);
        contentDock->raise();
        const QRect screen = QApplication::desktop()->screenGeometry();
        resize(4*screen.width()/5, 4*screen.height()/5);
    }

    if (!helpEngineWrapper.hasFontSettings()) {
        helpEngineWrapper.setUseAppFont(false);
        helpEngineWrapper.setUseBrowserFont(false);
        helpEngineWrapper.setAppFont(qApp->font());
        helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin);
        helpEngineWrapper.setBrowserFont(qApp->font());
        helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin);
    } else {
        updateApplicationFont();
    }

    updateAboutMenuText();

    QTimer::singleShot(0, this, SLOT(insertLastPages()));
    if (m_cmdLine->enableRemoteControl())
        (void)new RemoteControl(this);

    if (m_cmdLine->contents() == CmdLineParser::Show)
        showContents();
    else if (m_cmdLine->contents() == CmdLineParser::Hide)
        hideContents();

    if (m_cmdLine->index() == CmdLineParser::Show)
        showIndex();
    else if (m_cmdLine->index() == CmdLineParser::Hide)
        hideIndex();

    if (m_cmdLine->bookmarks() == CmdLineParser::Show)
        showBookmarksDockWidget();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Hide)
        hideBookmarksDockWidget();

    if (m_cmdLine->search() == CmdLineParser::Show)
        showSearch();
    else if (m_cmdLine->search() == CmdLineParser::Hide)
        hideSearch();

    if (m_cmdLine->contents() == CmdLineParser::Activate)
        showContents();
    else if (m_cmdLine->index() == CmdLineParser::Activate)
        showIndex();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Activate)
        showBookmarksDockWidget();

    if (!m_cmdLine->currentFilter().isEmpty()) {
        const QString &curFilter = m_cmdLine->currentFilter();
        if (helpEngineWrapper.customFilters().contains(curFilter))
            helpEngineWrapper.setCurrentFilter(curFilter);
    }

    if (usesDefaultCollection())
        QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation()));
    else
        checkInitState();

    connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)),
            this, SLOT(documentationRemoved(QString)));
    connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)),
            this, SLOT(documentationUpdated(QString)));

    setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    GlobalActions::instance()->updateActions();
    if (helpEngineWrapper.addressBarEnabled())
        showNewAddress();
}