Ejemplo n.º 1
0
void ListViews::slotFolderChanged( QListViewItem *i )
{
    if ( !i )
	return;
    messages->clear();
    message->setText( "" );

    FolderListItem *item = ( FolderListItem* )i;

    for ( Message* msg = item->folder()->firstMessage(); msg;
	  msg = item->folder()->nextMessage() )
	(void)new MessageListItem( messages, msg );
}
Ejemplo n.º 2
0
bool ImportOPJ::createProjectTree(const OPJFile &opj) {
  const tree<projectNode> *projectTree = opj.project();
  tree<projectNode>::iterator root = projectTree->begin(projectTree->begin());
  if (!root.node)
    return false;
  FolderListItem *item =
      static_cast<FolderListItem *>(mw->folders->firstChild());
  item->setText(0, root->name.c_str());
  item->folder()->setObjectName(root->name.c_str());
  Folder *projectFolder = mw->projectFolder();
  QHash<tree<projectNode>::iterator, Folder *> parent;
  parent[root] = projectFolder;
  for (tree<projectNode>::iterator sib = projectTree->begin(root);
       sib != projectTree->end(root); ++sib) {
    if (sib->type == 1) {
      parent[sib] = mw->addFolder(sib->name.c_str(),
                                  parent.value(projectTree->parent(sib)));
      parent[sib]->setBirthDate(JulianDateTime2String(sib->creation_date));
      parent[sib]->setModificationDate(
          JulianDateTime2String(sib->modification_date));
    } else {
      MdiSubWindow *w = projectFolder->window(sib->name.c_str());
      if (w) {
        parent.value(projectTree->parent(sib))->addWindow(w);
        projectFolder->removeWindow(w);
      }
    }
  }
  mw->changeFolder(projectFolder, true);
  return true;
}
Ejemplo n.º 3
0
Folder* FolderListView::currentFolder() const
{
    FolderListItem *item = currentFolderItem();
    if ( item != NULL )
        return item->folder();

    return NULL;
}
Ejemplo n.º 4
0
bool FolderListView::setCurrentFolder(const Folder* folder)
{
    QModelIndex index = model()->index( 0, 0 );
    for ( ; index.isValid(); index = next( index ) ) {
        FolderListItem *item = folderItemFromIndex( index );
        if ( item->folder() == folder ) {
            setCurrentItem( item );
            return true;
        }
    }

    return false;
}
Ejemplo n.º 5
0
QModelIndex FolderListView::accountFolderIndex(const Folder* account, const QString& mailbox) const
{
    QModelIndex index = model()->index( 0, 0 );
    for ( ; index.isValid(); index = next( index ) ) {
        FolderListItem* item = folderItemFromIndex( index );
        Folder* folder = item->folder();
        if ( ( mailbox.isNull() &&
               (folder == account) ) ||
             ( (folder->folderType() == FolderTypeMailbox) &&
               (static_cast<Mailbox*>(folder)->pathName() == mailbox) &&
               (itemAccount(item) == account) ) ) {
            break;
        }
    }

    return index;
}