Esempio n. 1
0
void
User::loadUser()
{
	AppRegistry* appRegistry = Application::GetInstance()->GetAppRegistry();
	User *user = currentUser();

	int id = 0;
	String fullname = "";
	String username = "";
	String email = "";

	appRegistry->Get(idKey, id);

	if (id != 0) {
		user->setId((unsigned)id);

		appRegistry->Get(fullnameKey, fullname);
		user->setFullname(fullname);

		appRegistry->Get(usernameKey, username);
		user->setUsername(username);

		appRegistry->Get(emailKey, email);
		user->setEmail(email);
	}
}
Esempio n. 2
0
void
ImageViewer::SaveImage(void)
{
	if(savedPath.GetLength() != 0)
		return;						/*Already saved*/

	result res = E_SUCCESS;
	Image img;
	String fileName;
	int lastFileName = 0;
	String fileNameKey("AppLastSavedFileNum");
	AppRegistry *pAppRegistry = Application::GetInstance()->GetAppRegistry();

	res = pAppRegistry->Get(fileNameKey, lastFileName);
	if ( res == E_KEY_NOT_FOUND)
	{
		lastFileName = 1;
		pAppRegistry->Add(fileNameKey, lastFileName);
	}

	savedPath = L"/Media/Images/";
	savedPath += Application::GetInstance()->GetAppName();
	savedPath.Append(lastFileName);
	savedPath += ".jpg";

	img.Construct();
	res = img.EncodeToFile(*__pDisplayImage, IMG_FORMAT_JPG, savedPath, true);

	pAppRegistry->Set(fileNameKey, lastFileName + 1);

}
Esempio n. 3
0
void ZAddAppDlg::procReg(QString FileRegistry)
{
	QString id;
	QString name;
	QString ico;
	static int i=0;
	
	ZConfig confReg ( FileRegistry, false );
	QStringList grouplist;
	confReg.getGroupsKeyList ( grouplist );
	for ( QStringList::Iterator it = grouplist.begin(); it != grouplist.end(); ++it ) 
	{	 
		name = confReg.readEntry ( *it, "Name", "" );
		id = confReg.readEntry ( *it, "AppID", "" );
		ico = confReg.readEntry ( *it, ICON_NAME, "" );
		#ifdef NEW_PLATFORM
		if (ico=="")
		{
			ico = confReg.readEntry ( *it, "Icon", "" );
		}		
		#endif		
		if (ico=="")
		{
			ico = confReg.readEntry ( *it, "BigIcon", "" );
		}		
		if ( (id!="")&&(name!=""))
		{
			AppRegistry app;
			app.setId(id);
			app.setName(name);
			#ifndef NEW_PLATFORM
			if ( ico.find(".g") == -1 && !QFile::exists(ico) )
			#else
			if ( ico.find(".g") == -1 && ico.find(".k") == -1 &&!QFile::exists(ico) )
			#endif
			{
					ico = confReg.readEntry ( *it, "Directory", "" ) + "/" + ico;
			}	
			app.setIcon(ico);
			mapApp[ i ] = app;
			addApp(name, ico, i);
			++i;
		}
	}	
}
Esempio n. 4
0
void ZAddAppDlg::accept()
{
	toLog("ZAddAppDlg: OK: Add app");
	
	int n = lbAppList->currentItem();
	
	if (n == -1) 
	{
		return;
	}
	
	#ifdef FIX_LISTBOX
	ZListBoxItem* listitem = lbAppList->item ( n );
	#else
	ZSettingItem* listitem = (ZSettingItem*)lbAppList->item ( n ); 
	#endif
	int id = listitem->getReservedData();
	
	ZConfig cfg(APP_CONF_NAME);
	
	for (int i=0;i<20;i++)
	{
		QString name = cfg.readEntry(QString("App"), QString("name"+QString::number(i)), "");
		if (name == "")
		{
			AppRegistry it = mapApp[id];
			cfg.writeEntry("App", "name"+QString::number(i), it.name() );
			cfg.writeEntry("App", "run"+QString::number(i), it.id() );
			cfg.writeEntry("App", "icon"+QString::number(i), it.icon() );
			break;
		}
	}
	 
	cfg.flush();
	
	toLog("ZAddAppDlg: OK:  End");
	
	MyBaseDlg::accept();
}
Esempio n. 5
0
void
User::saveUser()
{
	AppRegistry* appRegistry = Application::GetInstance()->GetAppRegistry();
	User *user = currentUser();

	// First time saving
	int i = 0;
	result r = appRegistry->Get(idKey, i);
	if (r == E_KEY_NOT_FOUND) {
		appRegistry->Add(idKey, 0);
		appRegistry->Add(fullnameKey, "");
		appRegistry->Add(usernameKey, "");
		appRegistry->Add(emailKey, "");
		appRegistry->Save();
	}

	if (user->id() != 0) {
		appRegistry->Set(idKey, (signed)user->id());
		appRegistry->Set(fullnameKey, user->fullname());
		appRegistry->Set(usernameKey, user->username());
		appRegistry->Set(emailKey, user->email());
	} else {
		appRegistry->Set(idKey, 0);
		appRegistry->Set(fullnameKey, "");
		appRegistry->Set(usernameKey, "");
		appRegistry->Set(emailKey, "");
	}

	appRegistry->Save();
}