亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? taskmanagerappview.cpp

?? c++下s60終端對終端傳輸協(xié)議
?? CPP
字號:
/*
* ============================================================================
*  Name     : CTaskManagerAppView from TaskManagerAppView.cpp
*  Part of  : TaskManager
*  Created  : 08/31/2005 by Forum Nokia
*  Version  : 1.1
*  Copyright: Nokia Corporation
* ============================================================================
*/

// INCLUDE FILES
#include <coemain.h>
#include <aknlists.h>			// CAknSingleStyleListBox
#include <barsread.h>			// TResourceReader
#include <aknnotewrappers.h>	// CAknInformationNote
#include <HttpTaskManager.rsg>
#include <stringloader.h>
#include <e32std.h>
#include <aknquerydialog.h>
#include "TaskManager.hrh"
#include "TaskManagerAppView.h"
#include "TaskManagerAppUi.h"
#include "Response.h"

// CONSTANTS
#define KListPosition TPoint(0,0)
_LIT(KTab, "\t");
_LIT(KError, "Error: %d");
_LIT(KNoTasks, "No Tasks!");
_LIT(KLoadingTasks, "Loading tasks...");
_LIT(KCompletingTask, "Completing task...");
_LIT(KTaskCompleted, "\n\nTask completed?");
_LIT(KInvalidTask, "Invalid task. Cannot complete.");
_LIT(KTaskFormat, "%d\t%S");
_LIT(KOpeningConnection, "Opening connection...");
const TInt KMaxErrorLength = 30;


// ================= MEMBER FUNCTIONS =======================

// constructor
CTaskManagerAppView::CTaskManagerAppView(CTaskManagerAppUi& aAppUi)
	:	iAppUi(aAppUi)
	{
	iStatusText = KNoTasks;
	}

// destructor
CTaskManagerAppView::~CTaskManagerAppView()
	{
	delete iTaskList;
	iTaskList = 0;
	}

// ----------------------------------------------------
// CTaskManagerAppView::NewL()
// Two-phased constructor.
// ----------------------------------------------------
//
CTaskManagerAppView *CTaskManagerAppView::NewL(const TRect& aRect, CTaskManagerAppUi& aAppUi)
	{
    CTaskManagerAppView *self = new(ELeave) CTaskManagerAppView(aAppUi);
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    CleanupStack::Pop(self);
    return self;
	}

// ----------------------------------------------------
// CTaskManagerAppView::ConstructL()
// Symbian OS default constructor can leave.
// ----------------------------------------------------
//	
void CTaskManagerAppView::ConstructL(const TRect& aRect)
	{
    // Create a window for this application view
    CreateWindowL();
	
	CreateListL();
	
    // Set the windows size
    SetRect(aRect);

    // Activate the window, which makes it ready to be drawn
    ActivateL();
	}

// ----------------------------------------------------
// CTaskManagerAppView::ConstructL()
// Creates a listbox that is used for showing the tasks
// to the user.
// ----------------------------------------------------
//
void CTaskManagerAppView::CreateListL()
	{
	iTaskList = new (ELeave) CAknSingleStyleListBox;
	iTaskList->SetContainerWindowL( *this );
	
	iTaskList->SetListBoxObserver( this );
	
	TResourceReader reader;
	iEikonEnv->CreateResourceReaderLC( reader, R_TASKMANAGER_TASKLIST );
	iTaskList->ConstructFromResourceL( reader );

	iTaskList->MakeVisible( EFalse );
	
	CleanupStack::PopAndDestroy(); // ResourceReader
	}


// ----------------------------------------------------
// CTaskManagerAppView::Draw()
// This function is used for window server-initiated 
// redrawing of controls, and for some 
// application-initiated drawing. Here we show the 
// status text to the user.
// ----------------------------------------------------
//
void CTaskManagerAppView::Draw(const TRect& /*aRect*/) const
	{
    // Get the standard graphics context 
    CWindowGc &gc = SystemGc();
    
    // Gets the control's extent
    TRect rect = Rect();
    
    // Clears the screen
    gc.Clear(rect);
    
    // status text is showed only if iTaskList isn't visible
    if( !iTaskList->IsVisible() )
    	{
   		gc.UseFont( iCoeEnv->NormalFont() );
   		
   		// This is done to center the text
   		TInt pointX = rect.Width() / 2 -
   					  iCoeEnv->NormalFont()->TextWidthInPixels( iStatusText ) / 2;

   		TInt pointY = rect.Height() / 2 -
   					  iCoeEnv->NormalFont()->HeightInPixels() / 2;
   					  
		gc.DrawText( iStatusText, TPoint( pointX, pointY ) );
    	}

	}

// ----------------------------------------------------
// CTaskManagerAppView::HandleListBoxEventL()
// Handles list box events. When enter key is pressed, 
// the selected task is marked completed.
// ----------------------------------------------------
//
void CTaskManagerAppView::HandleListBoxEventL(CEikListBox* aListBox, 
                                              TListBoxEvent aListBoxEvent)
	{
	if( aListBoxEvent == MEikListBoxObserver::EEventEnterKeyPressed )
		{

		const MDesCArray* items = aListBox->Model()->MatchableTextArray();
		
		// We get the currently selected item's text to print it in a query
		TPtrC pointer = items->MdcaPoint( aListBox->CurrentItemIndex() );
		
		TInt tabOffSet = pointer.Find(KTab);
		// id of the task was not found.
		if (tabOffSet == KErrNotFound || tabOffSet == 0)
			{
			CAknInformationNote *informationNote = new(ELeave) CAknInformationNote;
			informationNote->ExecuteLD(KInvalidTask);
			return;
			}
		
		TLex lex(pointer.Left(tabOffSet));
		TInt taskId;
		User::LeaveIfError(lex.Val(taskId));
		
		// (KMaxTaskLength +20) space for task and KTaskCompleted
		TBuf<KMaxTaskLength + 20> message = pointer.Mid(tabOffSet+1);
		message.Append( KTaskCompleted ); 
		
		// A waiting confirmation note
		CAknQueryDialog* note = CAknQueryDialog::NewL(); 
		CleanupStack::PushL(note);
		note->SetPromptL( message );
		CleanupStack::Pop(note);
		
		iAppUi.SetViewBusy(ETrue);
		
		// The query is shown
		if( note->ExecuteLD( R_TASKMANAGER_TASK_CONFIRMATION_QUERY ) )
			{
			// show 'Completing task' to the user.
			ShowStatus(KCompletingTask);
			
			iAppUi.ShowConnectingCbaL(ETrue);
			iAppUi.Model().MarkTaskDoneL(taskId);
			iTransactionStatus = EMarkingTaskDone;
			}		
		
		iAppUi.SetViewBusy(EFalse);
		}	
	}

// ----------------------------------------------------
// CTaskManagerAppView::DeleteSelectedTaskL()
// Removes the selected task from the listbox.
// ----------------------------------------------------
//
void CTaskManagerAppView::DeleteSelectedTaskL()
	{
	CTextListBoxModel* model = iTaskList->Model();
	CDesCArray* itemArray = static_cast<CDesCArray*>( model->ItemTextArray() );
	
	TInt currentItem = iTaskList->CurrentItemIndex();
	
	itemArray->Delete( currentItem );
	
	AknListBoxUtils::HandleItemRemovalAndPositionHighlightL( iTaskList,
															 currentItem,
															 ETrue );

	iTaskList->DrawNow();		
	
	// no more tasks, show 'No tasks' to user.													 
	if( model->NumberOfItems() == 0 )
		{
		iTaskList->MakeVisible( EFalse );
		}
	}

// ----------------------------------------------------
// CTaskManagerAppView::ReadTasksL()
// Reads tasks from aResponse and adds them to the listbox.
// ----------------------------------------------------
//
void CTaskManagerAppView::ReadTasksL( const CResponse& aResponse )
	{
	CTextListBoxModel* model = iTaskList->Model();
	
	model->SetOwnershipType( ELbmOwnsItemArray ); // Just to underline the relation
	CDesCArray* itemArray = static_cast<CDesCArray*>( model->ItemTextArray() );
										 
	itemArray->Reset();
	
	TInt taskCount = aResponse.TaskCount();
	// reserve space for task description and for taskid
	TBuf<KMaxTaskLength+10> taskDesc;
	for (TInt i = 0; i < taskCount; i++)
		{
		TBuf<KMaxTaskLength> desc = aResponse.TaskDescription(i);
		taskDesc.Format(KTaskFormat, aResponse.TaskId(i), &desc);
		itemArray->AppendL(taskDesc);
		}
	
	// If there are items in the listbox, make the listbox visible.
	if( model->NumberOfItems() > 0 )
		{
		iTaskList->HandleItemAdditionL();
		iTaskList->DrawNow();
		iTaskList->MakeVisible( ETrue );
		}
	}

// ----------------------------------------------------
// CTaskManagerAppView::CountComponentControls()
// Gets the number of controls contained in a compound 
// control. 
// ----------------------------------------------------
//
TInt CTaskManagerAppView::CountComponentControls() const
	{
	TInt count = 0;
	if (iTaskList)
		{
		count++;
		}
		
	return count;
	}

// ----------------------------------------------------
// CTaskManagerAppView::ComponentControl()
// Gets the specified component of a compound control.
// ----------------------------------------------------
//
CCoeControl* CTaskManagerAppView::ComponentControl( TInt aIndex ) const
	{
	switch( aIndex )
		{
		case 0:
			return iTaskList;
		default:
			return 0;
		};
	}

// ----------------------------------------------------
// CTaskManagerAppView::SizeChanged()
// Responds to size changes to sets the size and 
// position of the contents of this control. 
// ----------------------------------------------------
//	
void CTaskManagerAppView::SizeChanged()
	{
	iTaskList->SetExtent( KListPosition, iTaskList->MinimumSize() );	
	}

// ----------------------------------------------------
// CTaskManagerAppView::OfferKeyEventL()
// When a key event occurs, the control framework calls 
// this function for each control on the control stack, 
// until one of them can process the key event 
// (and returns EKeyWasConsumed).
// ----------------------------------------------------
//	
TKeyResponse CTaskManagerAppView::OfferKeyEventL( const TKeyEvent& aKeyEvent,
												  TEventCode aType )
	{
	if( iTaskList && iTaskList->IsVisible() )
		{
		return iTaskList->OfferKeyEventL( aKeyEvent, aType );
		}
	else
		{
		return EKeyWasNotConsumed;
		}
	}

// ----------------------------------------------------
// CTaskManagerAppView::OpeningConnectionL()
// Called when a GPRS connection is opened.
// ----------------------------------------------------
//	
void CTaskManagerAppView::OpeningConnectionL()
	{
	ShowStatus(KOpeningConnection);
	iAppUi.ShowConnectingCbaL(ETrue);
	}
	
// ----------------------------------------------------
// CTaskManagerAppView::ConnectingL()
// Called when an HTTP transaction is initiated. 
// ----------------------------------------------------
//
void CTaskManagerAppView::ConnectingToServerL(const TBool& aLoadingTasks)
	{
	if (aLoadingTasks)
		{
		ShowStatus(KLoadingTasks);
		}
	else
		{
		ShowStatus(KCompletingTask);
		}

	// show cancel button.
	iAppUi.ShowConnectingCbaL(ETrue);
	}

// ----------------------------------------------------
// CTaskManagerAppView::SuccessL()
// Called when the HTTP transaction is successfully 
// finished. 
// ----------------------------------------------------
//	
void CTaskManagerAppView::SuccessL(const CResponse& aResponse)
	{
	// even though HTTP transaction was successful, errors might have occurred
	// in the server database.
	if (aResponse.HasError())
		{
		CAknInformationNote *informationNote = new(ELeave) CAknInformationNote;
		informationNote->ExecuteLD(aResponse.Error());
		}
	// no errors.
	else
		{
		// we were completing a task, remove it from the listbox.
		if (iTransactionStatus == EMarkingTaskDone)
			{
			iTransactionStatus = EFetchingTasks;
			DeleteSelectedTaskL();
			}
		// we were loading tasks, show them in the listbox.
		else
			{
			ReadTasksL(aResponse);
			}
		}
	
	// will show 'No tasks' or if tasks exist, a list of tasks is shown.
	ShowStatus(KNoTasks);
	
	iAppUi.ShowConnectingCbaL(EFalse);
	}

// ----------------------------------------------------
// CTaskManagerAppView::FailedL()
// Called when the HTTP transaction failed. 
// ----------------------------------------------------
//	
void CTaskManagerAppView::FailedL(const TInt& aError)
	{
	TBuf<KMaxErrorLength> error;
	error.Format(KError, aError);
	CAknInformationNote *informationNote = new(ELeave) CAknInformationNote;
	informationNote->ExecuteLD(error);
	
	// will show 'No tasks' or if tasks exist, a list of tasks is shown.
	ShowStatus(KNoTasks);

	iAppUi.ShowConnectingCbaL(EFalse);
	}
	
// ----------------------------------------------------
// CTaskManagerAppView::CancelledL()
// Called when the HTTP transaction was cancelled by 
// the user. 
// ----------------------------------------------------
//	
void CTaskManagerAppView::CancelledL()
	{
	// will show 'No tasks' or if tasks exist, a list of tasks is shown.
	ShowStatus(KNoTasks);

	iAppUi.ShowConnectingCbaL(EFalse);
	}

// ----------------------------------------------------
// CTaskManagerAppView::ErrorL()
// Called when connection settings are invalid and the 
// HTTP transaction cannot be initiated. This occurs 
// e.g. when username and/or password is not set.
// ----------------------------------------------------
//	
void CTaskManagerAppView::ErrorL(const TDesC& aErrorMsg)
	{
	CAknInformationNote *informationNote = new(ELeave) CAknInformationNote;
	informationNote->ExecuteLD(aErrorMsg);
	
	// will show 'No tasks' or if tasks exist, a list of tasks is shown.
	ShowStatus(KNoTasks);

	iAppUi.ShowConnectingCbaL(EFalse);
	}

// ----------------------------------------------------
// CTaskManagerAppView::QueryIapL()
// Opens up a querylist dialog containing all IAPs. User 
// selects from the list the IAP that he/she wants to use.
// ----------------------------------------------------
//		
TBool CTaskManagerAppView::QueryIapL(TUint32& aId, const TUint32& aDefaultId)
	{
	TBool retval = EFalse;
	RArray<TIap>& iaps = iAppUi.Model().Iaps();
	TInt iapCount = iaps.Count();
	
	CDesCArrayFlat* iapArray = new (ELeave) CDesCArrayFlat(iapCount);
	CleanupStack::PushL(iapArray);
	
	TInt selectedIndex = 0;
	
	// Load all IAPs to the list.
	for (TInt i = 0; i < iapCount; i++)
		{
		if (iaps[i].iId == aDefaultId)
			{
			selectedIndex = i;
			}			
		iapArray->AppendL(iaps[i].iName);
		}
		
	TInt index(0);
	CAknListQueryDialog* query = new (ELeave) CAknListQueryDialog(&index);
	query->PrepareLC(R_TASKMANAGER_IAP_LIST_QUERY);
	query->SetItemTextArray(iapArray);
	query->SetOwnershipType(ELbmDoesNotOwnItemArray);
	query->ListBox()->SetCurrentItemIndex(selectedIndex);
	if (query->RunLD())
		{
		aId = iaps[index].iId;
		retval = ETrue;
		}
		
	CleanupStack::PopAndDestroy(iapArray);	
	return retval;
	}

// ----------------------------------------------------
// CTaskManagerAppView::ShowStatus()
// Shows proper status text to the user.
// ----------------------------------------------------
//	
void CTaskManagerAppView::ShowStatus(const TDesC& aStatus)
	{
	iStatusText = aStatus;
	
	// Show 'No tasks' or if tasks exist, show list of tasks.
	if (aStatus == KNoTasks)
		{
		if (iTaskList->Model()->NumberOfItems() > 0)
			{
			iTaskList->MakeVisible(ETrue);
			}
		}
	// Show only status text.
	else
		{
		iTaskList->MakeVisible(EFalse);
		}
		
	DrawNow();
	}
	
// End of file

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人免费视频一区| 欧美一区二区三区视频免费 | 日本一区中文字幕| 亚洲另类在线制服丝袜| 国产精品水嫩水嫩| 欧美国产欧美综合| 国产欧美精品在线观看| 国产女人18毛片水真多成人如厕| 欧美精品一区二区高清在线观看| 日韩欧美卡一卡二| 日韩视频免费观看高清完整版 | 日韩一本二本av| 日韩欧美国产综合| 精品国产亚洲在线| 久久久夜色精品亚洲| 国产蜜臀97一区二区三区| 国产亚洲欧美色| 欧美激情一区三区| 中文字幕日韩精品一区 | 国产激情偷乱视频一区二区三区| 精品在线播放免费| 国产精品77777竹菊影视小说| 国产不卡一区视频| 成人a免费在线看| 91伊人久久大香线蕉| 91福利精品第一导航| 欧美系列亚洲系列| 欧美成人精品3d动漫h| 久久久久久毛片| 一区精品在线播放| 亚洲午夜日本在线观看| 秋霞成人午夜伦在线观看| 狠狠色伊人亚洲综合成人| 成人网页在线观看| 色噜噜久久综合| 欧美一级欧美一级在线播放| 精品久久久网站| 国产精品久久久久久久浪潮网站 | 日韩精品一卡二卡三卡四卡无卡 | 日韩欧美一级精品久久| 久久综合色鬼综合色| 一区视频在线播放| 日本欧美大码aⅴ在线播放| 激情久久五月天| 91老司机福利 在线| 欧美精品日韩一本| 久久精品日产第一区二区三区高清版| 中文字幕一区二区三区视频| 亚洲一级二级三级| 极品尤物av久久免费看| 99久久综合国产精品| 欧美精品一二三区| 国产欧美精品国产国产专区| 亚洲午夜久久久久| 国产精品69毛片高清亚洲| 在线一区二区三区四区五区| 日韩精品中文字幕一区| 中文字幕日韩av资源站| 奇米综合一区二区三区精品视频| 国产99久久精品| 国产成人免费在线| 欧美精品日韩精品| 亚洲欧美日韩国产中文在线| 老司机免费视频一区二区三区| 成人免费视频一区| 日韩一区二区在线播放| 亚洲丝袜精品丝袜在线| 美国十次综合导航| 色哟哟在线观看一区二区三区| 日韩欧美在线综合网| 伊人色综合久久天天人手人婷| 韩国三级在线一区| 欧美日韩一本到| 国产精品久久久久久久蜜臀| 黄色日韩三级电影| 欧美疯狂性受xxxxx喷水图片| 国产精品美女久久久久久久久久久 | 亚洲男人的天堂一区二区| 国内外成人在线视频| 欧美日韩大陆在线| 亚洲黄色尤物视频| 成人三级在线视频| 国产视频在线观看一区二区三区| 日韩电影在线一区二区| 欧美亚洲丝袜传媒另类| 国产精品免费视频观看| 激情小说欧美图片| 欧美一区二区三区四区久久| 日本丶国产丶欧美色综合| 国产69精品久久久久777| 91精品国产综合久久精品性色| 综合电影一区二区三区| 国产剧情一区在线| 欧美一二三区在线| 日韩黄色一级片| 欧美天天综合网| 一区二区三区不卡视频| av一区二区不卡| 中文字幕免费不卡在线| 国产精品888| 国产午夜一区二区三区| 国内精品写真在线观看| 精品国产一区二区三区av性色| 青青草国产成人av片免费| 欧美福利视频导航| 免费高清在线一区| 日韩欧美aaaaaa| 久久 天天综合| 欧美成人女星排名| 精品无人码麻豆乱码1区2区 | 色综合中文综合网| 另类小说一区二区三区| 日韩欧美国产综合| 极品少妇xxxx精品少妇| 日韩精品一区国产麻豆| 美女视频黄久久| 欧美mv和日韩mv国产网站| 精品一区二区三区免费| 精品国产麻豆免费人成网站| 老汉av免费一区二区三区 | 国产精品久久久久久妇女6080| 国产精品主播直播| 久久久精品tv| 国产91丝袜在线播放九色| 欧美绝品在线观看成人午夜影视| 日韩成人免费在线| 日韩欧美在线影院| 激情文学综合网| 国产性天天综合网| 一本色道久久综合亚洲91| 亚洲蜜桃精久久久久久久| 91视频一区二区| 一区二区三区久久久| 欧美午夜精品免费| 日韩电影一区二区三区| 欧美一区二区三区免费| 精品写真视频在线观看| 国产亚洲精品bt天堂精选| 国产精品亚洲一区二区三区妖精 | 91麻豆精品视频| 亚洲精品乱码久久久久久| 欧美精品乱码久久久久久按摩 | 亚洲福中文字幕伊人影院| 欧美日韩dvd在线观看| 日韩高清在线观看| 欧美日韩免费电影| 国产乱码字幕精品高清av| 中文字幕免费不卡在线| 色综合天天综合给合国产| 亚洲五码中文字幕| 精品国产成人系列| 成人av电影在线网| 亚洲一二三四在线| 日韩午夜在线影院| 激情亚洲综合在线| 亚洲综合自拍偷拍| 欧美一区二区三区日韩| 国产精品一区在线观看乱码| 中文字幕一区二区三区精华液| 欧美剧情片在线观看| 国产福利91精品一区二区三区| 亚洲日韩欧美一区二区在线| 欧美日韩一区二区三区高清 | 麻豆精品一区二区三区| 国产日韩v精品一区二区| 91福利在线播放| 国产一区二区成人久久免费影院 | 91国模大尺度私拍在线视频| 视频一区在线播放| 国产精品久久久久久久久晋中 | 久久久久久久久99精品| 99久久99久久精品免费观看| 奇米精品一区二区三区在线观看一| 久久久www免费人成精品| 欧美精品乱人伦久久久久久| 国产99精品视频| 日韩黄色免费网站| 国产精品久久久久久久久免费丝袜| 色天天综合久久久久综合片| 国产精品自在欧美一区| 亚洲国产成人porn| 日本一区二区三区四区在线视频| 精品婷婷伊人一区三区三| 成人白浆超碰人人人人| 香蕉乱码成人久久天堂爱免费| 国产亚洲欧洲一区高清在线观看| 欧美精品在线观看播放| 91视频国产资源| 成人午夜免费视频| 日本女人一区二区三区| 亚洲精品日韩一| 国产欧美1区2区3区| 欧美一区二区三区小说| 色久综合一二码| 国产精品99久| 蜜臀av国产精品久久久久| 亚洲日本va午夜在线影院| 国产欧美精品区一区二区三区| 欧美大度的电影原声| 欧美日韩国产一区二区三区地区|