File: needfoldertask.cpp

package info (click to toggle)
kopete 4%3A17.08.3-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 38,864 kB
  • sloc: cpp: 348,298; ansic: 13,983; xml: 1,775; lex: 1,735; python: 421; sh: 271; perl: 126; ruby: 28; makefile: 18
file content (58 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// C++ Implementation: %{MODULE}
//
// Description:
//
//
// Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "needfoldertask.h"

#include "client.h"
#include "tasks/createcontactinstancetask.h"
#include "tasks/createfoldertask.h"

NeedFolderTask::NeedFolderTask(Task* parent): ModifyContactListTask(parent)
{
}

NeedFolderTask::~NeedFolderTask()
{
}

void NeedFolderTask::createFolder()
{
	CreateFolderTask * cct = new CreateFolderTask( client()->rootTask() );
	cct->folder( 0, m_folderSequence, m_folderDisplayName );
	connect( cct, SIGNAL(gotFolderAdded(FolderItem)), client(), SIGNAL(folderReceived(FolderItem)) );
	connect( cct, SIGNAL(gotFolderAdded(FolderItem)), SLOT(slotFolderAdded(FolderItem)) );
	connect( cct, SIGNAL(finished()), SLOT(slotFolderTaskFinished()) );
	cct->go( true );
}

void NeedFolderTask::slotFolderAdded( const FolderItem & addedFolder )
{
	// if this is the folder we were trying to create
	if ( m_folderDisplayName == addedFolder.name )
	{
		client()->debug( QString( "NeedFolderTask::slotFolderAdded() - Folder %1 was created on the server, now has objectId %2" ).arg( addedFolder.name ).arg( addedFolder.id ) );
		m_folderId = addedFolder.id;
	}
}

void NeedFolderTask::slotFolderTaskFinished()
{
	CreateFolderTask *cct = ( CreateFolderTask* )sender();
	if ( cct->success() )
	{
		// call our child class's action to be performed
		onFolderCreated();
	}
	else
		setError( 1, "Folder creation failed" );
}

#include "needfoldertask.moc"