Example #1
0
HeaderItem* HeaderItemList::getItem(FPTreeItem *item)
{
    bool found = false;
    HeaderItem *itemFound = NULL;
    HeaderItem *temp = NULL;
    FPTreeItem *tempFPItem = NULL;
    
    NodeLL *curr = head;
    while (!found && curr!=NULL) {
        temp = (HeaderItem*)curr->getData();
        
        if(temp != NULL)
        {
            tempFPItem = (FPTreeItem*)temp->getData();
            
            //DEBUG print
//            cout << "Comparting:";
//            tempFPItem->print();
//            cout << " with ";
//            item->print();
//            cout << "\n";
            
            if (tempFPItem != NULL && tempFPItem->getData()==item->getData())
            {
                itemFound = temp;
                found = true;
            }
        }
        
        curr = curr->getNext();
    }
    return itemFound;
}
QModelIndex HtModelPrototype::index(int row,
                                    int column,
                                    const QModelIndex &parent) const
{

   if (!hasIndex(row, column, parent))
   {
        return QModelIndex();
   }
    HeaderItem * parentItem;
    if(!parent.isValid())
    {
        parentItem=m_rootItem;
    }
    else
    {
        parentItem=static_cast<HeaderItem *>
                   (parent.internalPointer());

    }
    if(parentItem->childs().count()>row)
    {

        return createIndex(row,column,parentItem->childs().at(row));
    }
    else
    {
        return QModelIndex();
    }

}
Example #3
0
// Profiling note: About 30% of the time taken to initialize the
// listview is spent in this function. About 60% is spent in operator
// new and QListViewItem::QListViewItem.
void HeaderItem::irefresh()
{
  KMHeaders *headers = static_cast<KMHeaders*>(listView());
  NestingPolicy threadingPolicy = headers->getNestingPolicy();
  if ((threadingPolicy == AlwaysOpen) ||
      (threadingPolicy == DefaultOpen)) {
    //Avoid opening items as QListView is currently slow to do so.
    setOpen(true);
    return;

  }
  if (threadingPolicy == DefaultClosed)
    return; //default to closed

  // otherwise threadingPolicy == OpenUnread
  if (parent() && parent()->isOpen()) {
    setOpen(true);
    return;
  }

  KMMsgBase *mMsgBase = headers->folder()->getMsgBase( mMsgId );
  mSerNum = mMsgBase->getMsgSerNum();
  if (mMsgBase->isNew() || mMsgBase->isUnread()
      || mMsgBase->isImportant() || mMsgBase->isTodo() || mMsgBase->isWatched() ) {
    setOpen(true);
    HeaderItem * topOfThread = this;
    while(topOfThread->parent())
      topOfThread = (HeaderItem*)topOfThread->parent();
    topOfThread->setOpenRecursive(true);
  }
}
Example #4
0
NodeLL* HeaderItemList::extract(int item)
{
    NodeLL *curr = head;
    NodeLL *currPrev = NULL;
    NodeLL *currNext = NULL;
    NodeLL *result = NULL;
    
    HeaderItem *currItem = NULL;
    bool found = false;
    while (!found && curr !=NULL)
    {
        currItem = dynamic_cast<HeaderItem*>(curr->getData());
        
        if(currItem!=NULL && currItem->getData() != NULL) {
            found = currItem->getData()->getData() == item;
            
            if(found) {
                result = curr;
                
                currNext = curr->getNext();
                currPrev = curr->getPrev();
                
                if(curr == head) {
                    head = currNext;
                    
                    if(currNext!=NULL)
                        currNext->setPrev(NULL);
                }else if(curr == tail) {
                    tail = currPrev;
                    
                    if(currPrev!=NULL)
                        currPrev->setNext(NULL);
                }else {
                    currPrev->setNext(currNext);
                    currNext->setPrev(currPrev);
                }
                
                curr->setNext(NULL);
                curr->setPrev(NULL);
            }
        }
        
        curr = curr->getNext();
    }
    
    return result;
}
Example #5
0
/*-------------------------------------------------------------------------------------
 * PURPOSE: sorts the array (including NULLS) in drecreasing frequency
 * PARM   : array[] to be sorted
 * PARM   : len - size of array[]
 *-----------------------------------------------------------------------------------*/
void HeaderTable::insertionSort(HeaderItem *array[], int len){
    HeaderItem *temp;
    int j;
    
    for (int i=1; i<len; i++){
        temp = array[i];

        if (temp != NULL){
            //swap temp if it is higher priority
            for (j=i; j>0 &&
                 ((array[j-1] == NULL) || (temp->compareTo(array[j-1]) > 0))
                 ; j--){
                array[j] = array[j-1];
            }
            array[j] = temp;
        }
    }
}
QModelIndex HtModelPrototype::parent(const QModelIndex &child) const
{
    if (!child.isValid())
        return QModelIndex();

    HeaderItem *childItem = static_cast<HeaderItem*>(child.internalPointer());
    HeaderItem *parentItem = childItem->parent();

    if (parentItem==0 ||
            parentItem == m_rootItem)
        return QModelIndex();

    HeaderItem * superParent=parentItem->parent();
    if(superParent)
    {
        return createIndex(superParent->childs().indexOf(parentItem),
                           0, parentItem);
    }
    return createIndex(0,
                       0, parentItem);
}
Example #7
0
/*-------------------------------------------------------------------------------------
 * PURPOSE: increments the count for the given item in the table
 *          - If the item does not exist, then adds the given item to table
 *          - else increments the existing similar item in table
 * PARM   : FPTreeItem, item to be incremented
 *-----------------------------------------------------------------------------------*/
void HeaderTable::increment(FPTreeItem *item){
    HeaderItem* found;
    int hashIndex;

    if (item != NULL){
        hashIndex = getHashIndex(item);
        
        if (hashIndex >=0 && hashIndex < MAX_DOMAIN_ITEMS){
            found = freqItems[hashIndex];
            
            if (found == NULL){ //if no entry
                FPTreeNode *tempFPTreeNode = new FPTreeNode(item, NULL, NULL);
                HeaderItem *tempHeader  = new HeaderItem(tempFPTreeNode);
                this->freqItems[hashIndex] = tempHeader;
                this->numDomainItems++;
            } else {
                found->getNode()->getData()->increaseSupport(item);
                delete(item);
            }
        }
    }
}
Example #8
0
void  HeaderTable::incrementHashItem(HeaderItem *hash[MAX_DOMAIN_ITEMS], FPTreeItem *item){
    HeaderItem *found;
    int hashIndex = -1;
    
    if (item != NULL && hash != NULL){
        hashIndex = HeaderTable::getHashIndex(item);
        
        if (hashIndex >= 0 && hashIndex < MAX_DOMAIN_ITEMS){
            found = hash[hashIndex];
            
            if (found == NULL){ //if no entry
                FPTreeNode *tempFPTreeNode = new FPTreeNode(item, NULL, NULL);
                HeaderItem *tempHeader  = new HeaderItem(tempFPTreeNode);
                hash[hashIndex] = tempHeader;
            } else {
                found->getNode()->getData()->increaseSupport(item);
                delete(item);
            }

        }
    }
}
Example #9
0
// used for projected tree header tables
HeaderItem* HeaderItemList::insertByExpSupport(HeaderItem *item)
{
    HeaderItem *targetItem = NULL;
    NodeLL *newNode = new NodeLL(item);
    NodeLL *extractedNode = NULL;
    
    if(head == NULL && tail == NULL)
    {
        head = newNode;
        tail = head;
        targetItem = item;
    }else {
        
        if( item != NULL && item->getData() != NULL) {
            
            // extract node containing same domain item
            extractedNode = extract(item->getData()->getData());
            
            // new item 
            if(extractedNode==NULL) {
                targetItem = item;
                orderedInsert(item);
            }else {
                // DEBUG memory check for item
                targetItem = (HeaderItem*)extractedNode->getData();
                targetItem->increaseSupport(item->getData()->getSupport());
                targetItem->increaseExpSuport(item->getExpSupport()); 
                orderedInsert(targetItem);
                
                // DEBUG check
                delete item;
            }
        }
    }
    
    return targetItem;
}
Example #10
0
void HeaderItemList::removeInfrequent(float minsup)
{
    NodeLL *curr = head;
    HeaderItem *currHItem = NULL;
    NodeLL *tempNext = NULL;
    int infreqId = 0;
    
    while (curr!=NULL)
    {
        currHItem = (HeaderItem*)curr->getData();
        
        // get next pointer as this node might get destroyed if infreq
        tempNext = curr->getNext();
        
        if(currHItem !=NULL && currHItem->getExpSupport() < minsup)
            infreqId++;
        
        if(infreqId>=1) {
            if(infreqId==1)
            {
                if(curr->getPrev()!=NULL) {
                    curr->getPrev()->setNext(NULL);
                    tail = curr->getPrev();
                }else {
                    head = NULL;
                    tail = NULL;
                }
            }
            
            currHItem->removeInfreqPathItems();
            
            delete (curr);
        }
        
        curr = tempNext;
    }
}
Example #11
0
result HeaderForm::OnInitializing(int index) {
	result r = E_SUCCESS;
	headerIndex = index;
	/*
	 * I18N
	 */
	String routePlanner = "Routeplanner";
	String liveboard = "Liveboard";
	AppResource* appRes = Application::GetInstance()->GetAppResource();
	appRes->GetString(L"HEADER_ROUTEPLANNER", routePlanner);
	appRes->GetString(L"HEADER_LIVEBOARD", liveboard);

	/*
	 * set OrientationListener
	 */
	this->SetOrientation(ORIENTATION_AUTOMATIC);
	this->AddOrientationEventListener(*this);

	// set header
	Header* headerObj = this->GetHeader();
	headerObj->SetStyle(HEADER_STYLE_SEGMENTED);

	// Liveboard header
	HeaderItem liveBoardHeaderItem;
	liveBoardHeaderItem.Construct(HEADER_ID_LIVEBOARD);
	liveBoardHeaderItem.SetText(liveboard);
	liveBoardHeaderItem.SetActionId(this->ACTION_HEADER_ID_LIVEBOARD);

	// routePlanner header
	HeaderItem routePlannerHeaderItem;
	routePlannerHeaderItem.Construct(HEADER_ID_ROUTE_PLANNER);
	routePlannerHeaderItem.SetText(routePlanner);
	routePlannerHeaderItem.SetActionId(this->ACTION_HEADER_ID_ROUTE_PLANNER);

	/*
	 * create HeaderItems
	 */
	headerObj->AddItem(routePlannerHeaderItem);
	headerObj->AddItem(liveBoardHeaderItem);
	headerObj->SetItemSelected(index);
	/*
	 * add header action listener
	 */

	headerObj->AddActionEventListener(*this);
	return r;
}
Example #12
0
void
OverlayKeypadForm::OnKeypadOpened(Control& source)
{
	Header* pHeader = GetHeader();

	HeaderItem doneItem;
	HeaderItem cancelItem;

	doneItem.Construct(ID_BUTTON_DONE);
	doneItem.SetText("Done");

	cancelItem.Construct(ID_BUTTON_CANCEL);
	cancelItem.SetText("Cancel");

	pHeader->SetStyle(HEADER_STYLE_BUTTON);
	pHeader->AddItem(doneItem);
	pHeader->AddItem(cancelItem);
	pHeader->AddActionEventListener(*this);
}
Example #13
0
/*******************************************************************************
    slot_on_directory_loaded
*******************************************************************************/
void FileScene::slot_on_directory_loaded()
{
    loading_directory = true;
    Debug::debug() << "   [FileScene] slot_on_directory_loaded";

    /* clear the scene FIRST */
    clear();
    m_infosize = 0;
    
    QStringList urls;
    
    /* populate scene */
    int folderRow     = 0;
    int trackRow      = 0;
    int Column        = 0;
    int categorieRow  = 0;
    
    item_count = (parentView()->width()/140 > 2) ? parentView()->width()/140 : 2;


    
    //! header item
    HeaderItem* header = new HeaderItem(qobject_cast<QGraphicsView*> (parentView())->viewport());
    header->setText( tr("Directories") );
    header->setPos(0, 5);
    addItem(header);    

    categorieRow++;
    
    CategorieGraphicItem *cat = new CategorieGraphicItem(qobject_cast<QGraphicsView*> (parentView())->viewport());
    cat->m_name = m_model->rootPath();
    cat->setPos( 0 ,10 + categorieRow*50);
    categorieRow++;
    addItem(cat);


    
    QModelIndex root_idx = m_model->index(m_current_path);
    
    
    for(int childRow = 0; childRow < m_model->rowCount(root_idx); ++childRow) 
    {
        QModelIndex childIndex = root_idx.child(childRow, 0);

        QFileInfo fileInfo = m_model->fileInfo ( childIndex );

        const QString path = fileInfo.canonicalFilePath();

        if(!m_filter.isEmpty() && !path.contains(m_filter,Qt::CaseInsensitive)) continue;

        if(fileInfo.isDir()) {
          DirectoryGraphicItem *item = new DirectoryGraphicItem();
          item->setPath(fileInfo.canonicalFilePath());
          item->setDirname(QDir(fileInfo.canonicalFilePath()).dirName());
          item->setPixmap(m_folder_pixmap);
          item->setPos(4+140*Column, 10 + folderRow*150 + categorieRow*50);
          addItem(item);
          //Debug::debug() << "FileScene::PopulateScene add item : " << item->path();
          m_infosize++;
        } // isDir
        else
        {
          urls << path;
          continue;
        }

        if(Column < (item_count-1)) {
          Column++;
        }
        else {
          Column = 0;
          folderRow++;
        }
    }  

    if(Column > 0)
      folderRow++;
    
    foreach (QString url, urls) 
    {    
        TrackGraphicItem_v4 *track_item = new TrackGraphicItem_v4();
      
        MEDIA::TrackPtr track = MEDIA::FromDataBase(url);
  
        //Debug::debug() << "FileScene try find url : " << url;
        if(!track) 
        {
          track = MEDIA::TrackPtr(new MEDIA::Track());

          track->id           =  -1;
          track->url          =  url;
          track->isPlaying    =  false;
          track->isBroken     =  false;
          track->isPlayed     =  false;
          track->isStopAfter  =  false;
  
          map_graphic_items[url] = track_item;
          QtConcurrent::run(this, &FileScene::async_load_item, track, url);
        }


        track_item->media = track;
        track_item->setPos(30,  10 + folderRow*150 + categorieRow*50 + trackRow*20);
        track_item->_width = parentView()->width()-30-20;
        addItem(track_item);
        trackRow++; 
        m_infosize++;


    }
Example #14
0
result
EventListForm::OnInitializing(void)
{
	result r = E_SUCCESS;

	Header* pHeader = GetHeader();
	AppAssert(pHeader);

	DateTime today;
	String formattedString;

	SystemTime::GetCurrentTime(WALL_TIME, today);

	__pLocaleCalendar = Tizen::Locales::Calendar::CreateInstanceN(CALENDAR_GREGORIAN);
	__pLocaleCalendar->SetTime(today);
	DateTimeFormatter* pDateFormatter = DateTimeFormatter::CreateDateFormatterN(DATE_TIME_STYLE_DEFAULT);

	String customizedPattern = L"dd MMM yyyy";
	pDateFormatter->ApplyPattern(customizedPattern);
	pDateFormatter->Format(*__pLocaleCalendar, formattedString);

	HeaderItem headerDaily;
	headerDaily.Construct(ID_HEADER_DAILY);
	headerDaily.SetText(L"일");

	HeaderItem headerMonthly;
	headerMonthly.Construct(ID_HEADER_MONTHLY);
	headerMonthly.SetText(L"월");

	pHeader->SetStyle(HEADER_STYLE_SEGMENTED_WITH_TITLE);
	pHeader->SetTitleText(formattedString);
	pHeader->AddItem(headerDaily);
	pHeader->AddItem(headerMonthly);
	pHeader->AddActionEventListener(*this);

	Footer* pFooter = GetFooter();
	AppAssert(pFooter);
	pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT);

	FooterItem footerCreate;
	footerCreate.Construct(ID_FOOTER_CREATE);
	footerCreate.SetText(L"일정 생성");
	pFooter->AddItem(footerCreate);

	SetFormBackEventListener(this);
	pFooter->AddActionEventListener(*this);

	Tizen::Ui::Controls::Button* pPreviousButton = new (std::nothrow) Button();
	pPreviousButton->Construct(Rectangle(0, 0, GetClientAreaBounds().width / 2, 72), L"이전");
	pPreviousButton->SetActionId(ID_BUTTON_PREV);
	pPreviousButton->AddActionEventListener(*this);
	AddControl(pPreviousButton);

	Tizen::Ui::Controls::Button* pNextButton = new (std::nothrow) Button();
	pNextButton->Construct(Rectangle(GetClientAreaBounds().width / 2, 0, GetClientAreaBounds().width / 2, 72), L"다음");
	pNextButton->SetActionId(ID_BUTTON_NEXT);
	pNextButton->AddActionEventListener(*this);
	AddControl(pNextButton);

	__pGroupedListView = new (std::nothrow) GroupedListView();
	__pGroupedListView->Construct(Rectangle(0, 72, GetClientAreaBounds().width, GetClientAreaBounds().height - 72), GROUPED_LIST_VIEW_STYLE_INDEXED, true, SCROLL_STYLE_FADE_OUT);
	__pGroupedListView->SetTextOfEmptyList(L"일정 없음");
	__pGroupedListView->SetItemProvider(*this);
	__pGroupedListView->AddGroupedListViewItemEventListener(*this);
	__pGroupedListView->SetItemDividerColor(Tizen::Graphics::Color::GetColor(COLOR_ID_BLACK));
	AddControl(__pGroupedListView);

	LocaleManager localeManager;
	localeManager.Construct();
	__timeZone = localeManager.GetSystemTimeZone();

	return r;
}