コード例 #1
0
void OutlineModel::setDocument(Document *document) {
    if (m_doc != document) {

        if (m_doc) {
            QObject::disconnect(m_doc, SIGNAL(aboutToReset()), this, SLOT(reset()));
        }

        m_doc = document;

        if (m_doc) {
            QObject::connect(m_doc, SIGNAL(aboutToReset()), this, SLOT(reset()));
        }
        m_outline = document->outline();
        emit documentChanged();
    }
}
コード例 #2
0
ファイル: document.cpp プロジェクト: foolab/harbour-documents
Document::~Document() {
  // We need to emit those manually because init() emits them
  // and init() calls clearPages()
  // emitting the signals in clearPages() will cause a double emission of the signals.
  emit aboutToReset();
  clearPages();
  clearDocument();
}
コード例 #3
0
ファイル: document.cpp プロジェクト: foolab/harbour-documents
void Document::init(const QString& filePath, const QString& mimeType) {
  m_filePath = filePath;
  emit filePathChanged();

  m_mimeType = mimeType;
  emit mimeTypeChanged();

  setState(Document::Loading);

  if (!m_pages.isEmpty()) {
    emit aboutToReset();
    clearPages();
  }

  clearDocument();

  m_loader = new DocumentLoader;
  QObject::connect(m_loader, SIGNAL(done()), this, SLOT(loaderDone()));
  QObject::connect(m_loader, SIGNAL(error()), this, SLOT(loaderError()));
  QObject::connect(m_loader, SIGNAL(locked()), this, SLOT(loaderLocked()));
  m_loader->start(m_filePath, m_mimeType);
}
コード例 #4
0
void EntryAttachmentsModel::setEntryAttachments(EntryAttachments* entryAttachments)
{
    beginResetModel();

    if (m_entryAttachments) {
        m_entryAttachments->disconnect(this);
    }

    m_entryAttachments = entryAttachments;

    if (m_entryAttachments) {
        connect(m_entryAttachments, SIGNAL(keyModified(QString)), SLOT(attachmentChange(QString)));
        connect(m_entryAttachments, SIGNAL(aboutToBeAdded(QString)), SLOT(attachmentAboutToAdd(QString)));
        connect(m_entryAttachments, SIGNAL(added(QString)), SLOT(attachmentAdd()));
        connect(m_entryAttachments, SIGNAL(aboutToBeRemoved(QString)), SLOT(attachmentAboutToRemove(QString)));
        connect(m_entryAttachments, SIGNAL(removed(QString)), SLOT(attachmentRemove()));
        connect(m_entryAttachments, SIGNAL(aboutToBeReset()), SLOT(aboutToReset()));
        connect(m_entryAttachments, SIGNAL(reset()), SLOT(reset()));
    }

    endResetModel();
}