void xInstaller::extAssign( AppEntry * app, QStringList slExt ) { toLog( "@ extAssign" ); QStringList::Iterator it; QStringList slTypes; slTypes.clear(); QFile file( MOD_MIME_TYPE ); if ( !file.open( IO_ReadWrite ) ) return; toLog( "Find exist type" ); QTextStream stream( &file ); QString line; while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n' for ( int i=slExt.count()-1; i>=0; i-- ) { it = slExt.at(i); if ( line.find( *it, line.find(" ") ) > 0 ) { slTypes.append( line.left( line.find(" ") ) ); slExt.remove( it ); } } } toLog( "write ne types" ); QString types; for ( it = slExt.begin(); it != slExt.end(); ++it ) { types = "file/x-" + *it; slTypes.append( types ); stream << (types + " " + *it + "\n"); } file.close(); toLog( "write user mime" ); ZConfig userMime ( MOD_USER_MIME ); for ( it = slTypes.begin(); it != slTypes.end(); ++it ) { userMime.writeEntry ( *it, "AppList", app->appId+";"); userMime.writeEntry ( *it, "AppID", app->appId); } userMime.flush(); toLog( "Send update mime" ); QCopChannel::send("/AM/MimeRegistry", "update()"); }
void ZGui::eliminarTipoDELETE() { QString aux=""; ZConfig conf ( getProgramDir() + "av_db.cfg", true ); QStringList list = conf.readListEntry ( QString("DATABASE"), QString("DELETE"), QChar(';') ); ZSingleSelectDlg * dlg = new ZSingleSelectDlg("Remove", "Select type", this, "ZSingleSelectDlg", true, 0, 0); dlg->addItemsList(list); dlg->exec(); int elegido=dlg->getCheckedItemIndex(); aux=list[elegido]; list.remove(list[elegido]); conf.writeEntry(QString("DATABASE"), QString("DELETE"), list, ';'); dlg=NULL; if(infos==NULL) { infos = new ZNoticeDlg(ZNoticeDlg::Information, 3000, QString("OK"), QString("Type " + aux +" removed"), this, "z", true, 0); infos->show(); } infos=NULL;
void ZGui::agregarTipoASK() { QString aux=""; ZSingleCaptureDlg* dialogo = new ZSingleCaptureDlg ( "Add type", "Enter new file type", ZSingleCaptureDlg::normal, NULL, "dlg", true, 0, 0 ); if ( dialogo->exec() ) { aux = dialogo->getResultText(); }dialogo=NULL; if(aux!="") { ZConfig conf ( getProgramDir() + "av_db.cfg", true ); QStringList list = conf.readListEntry ( QString("DATABASE"), QString("ASK"), QChar(';') ); list += aux; conf.writeEntry(QString("DATABASE"), QString("ASK"), list, ';');} if(infos==NULL) { infos = new ZNoticeDlg(ZNoticeDlg::Information, 3000, QString("OK"), QString("Type " + aux +" added"), this, "z", true, 0); infos->show(); } infos=NULL;
void xInstaller::writeToRegistry( AppEntry * app ) { QString cfgFile; switch ( app->device ) { case AM_Global::Flash2: cfgFile = "/ezxlocal/download/appwrite/am/InstalledDB"; break; case AM_Global::Card1: cfgFile = "/mmc/mmca1/.system/java/CardRegistry"; break; default: break; } ZConfig registry( cfgFile ); registry.writeEntry(app->appId, "Name", app->name); registry.writeEntry(app->appId, "ObjectType", 2); registry.writeEntry(app->appId, "AniIcon", app->directory+"/"+app->aniIcon); registry.writeEntry(app->appId, "AppID", app->uid); registry.writeEntry(app->appId, "AppType", app->m_type); registry.writeEntry(app->appId, "Args", ""); registry.writeEntry(app->appId, "Attribute", 1); registry.writeEntry(app->appId, "Directory", app->directory); registry.writeEntry(app->appId, "BigIcon", app->directory+"/"+app->bigIcon); registry.writeEntry(app->appId, "SimpleIcon", app->directory+"/"+app->simpleIcon); registry.writeEntry(app->appId, "SVGIcon", app->directory+"/"+app->simpleIcon); registry.writeEntry(app->appId, "Icon", app->directory+"/"+app->simpleIcon); registry.writeEntry(app->appId, "Daemon", 1); registry.writeEntry(app->appId, "ExecId", app->exec); registry.writeEntry(app->appId, "GroupID", "root"); registry.writeEntry(app->appId, "UserID", "root"); registry.writeEntry(app->appId, "LockEnabled", 0); registry.writeEntry(app->appId, "Erasable", app->isErasable); registry.writeEntry(app->appId, "Shared", app->isShared); registry.writeEntry(app->appId, "Vendor", app->vendor); registry.writeEntry(app->appId, "Version", app->version); registry.writeEntry(app->appId, "Size", app->appSize); QDate d = QDateTime::currentDateTime().date(); QString sDate; sDate.sprintf("%.4d/%.2d/%.2d",d.year(),d.month(),d.day()); registry.writeEntry ( app->appId, "InstalledDate", sDate ); if ( app->device == AM_Global::Card1 ) { QString imei = getIMEI(); registry.writeEntry ( app->appId, "IMEI", imei ); ZConfig regconf("/mmc/mmca1/.system/java/MemoryCardConfig"); regconf.writeEntry ( app->appId, "IMEI", imei ); regconf.writeEntry ( app->appId, "Folder", app->parentFolderUid); regconf.flush(); } registry.flush(); ZConfig userMenuTree ( "/ezxlocal/download/appwrite/am/UserMenuTree" ); QString list = userMenuTree.readEntry(app->parentFolderUid, "Items", ""); if ( !list.endsWith(";") ) list=list+";"; if ( list.find(app->appId+";")==-1 ) { //write change userMenuTree.writeEntry(app->parentFolderUid, "Items", list+app->appId+";"); userMenuTree.flush(); //update menu QByteArray data; QDataStream stream(data, IO_WriteOnly); stream << getpid() << app->appId << app->parentFolderUid << app->position << false; QCopChannel::send("AM/AppRegistry/Channel", "appApplicatonObject()", data); } }