Changeset 1475 for trunk/gsinstaller/gsProgman.cpp
- Timestamp:
- 2000-08-31T00:42:59+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsinstaller/gsProgman.cpp
r1397 r1475 80 80 } 81 81 82 gsProgramManager::gsProgramManager() 82 gsProgramManager::gsProgramManager(installManager &manager) 83 : installAgent(manager) 83 84 { this->platform = new gsPlatform(); 84 85 this->connected = false; 86 } 87 88 void gsProgramManager::logAction(string actionName, string group) 89 { manager->writeString(actionName); 90 manager->writeSeparator(); 91 manager->writeString(group); 92 manager->writeString("\n"); 93 } 94 95 void gsProgramManager::logAction(string actionName, string group, string item, string parameter) 96 { manager->writeString(actionName); 97 manager->writeSeparator(); 98 manager->writeString(group); 99 manager->writeSeparator(); 100 manager->writeString(item); 101 manager->writeSeparator(); 102 manager->writeString(parameter); 103 manager->writeString("\n"); 104 } 105 106 bool gsProgramManager::undoAction(string actionName, stringArray ¶ms) 107 { if (actionName == "ProgManCreateGroup") 108 { this->removeProgramGroup(params[0]); 109 return true; 110 } 111 else if (actionName == "ProgManAddIcon") 112 { this->removeIcon(params[0], params[1]); 113 return true; 114 } 115 return false; 85 116 } 86 117 … … 123 154 } 124 155 125 bool gsProgramManager::addProgramGroup( const char *groupName)156 bool gsProgramManager::addProgramGroup(string groupName) 126 157 { //CreateGroup(groupName); 127 158 char buffer[256]; … … 147 178 else 148 179 { // add using program manager DDE 149 sprintf(buffer, "[CreateGroup (%s)]", groupName );180 sprintf(buffer, "[CreateGroup (%s)]", groupName.c_str()); 150 181 if (!DDEShellCommand(this->instance, buffer)) 151 182 { // flag error by returning false … … 153 184 } 154 185 } 186 187 this->logAction("ProgManCreateGroup", groupName); 155 188 return true; 156 189 } 157 190 158 bool gsProgramManager::addIcon( const char *groupName, // group of the icon159 const char *iconName,// name of the icon160 const char *iconDestination,// destination file of the icon161 const char *description)// the textual description162 191 bool gsProgramManager::addIcon( string groupName, // group of the icon 192 string iconName, // name of the icon 193 string iconDestination, // destination file of the icon 194 string description) // the textual description 195 // of the icon (not usually displayed) 163 196 { bool reply = false; 164 197 char buffer[MAX_PATH]; … … 176 209 177 210 SHGetPathFromIDList(pidl, buffer); 178 fullPath = new FilePath(4, buffer, groupName , iconName, "!.lnk");211 fullPath = new FilePath(4, buffer, groupName.c_str(), iconName.c_str(), ".lnk"); 179 212 180 213 // Get a pointer to the IShellLink interface. … … 186 219 // Set the path to the shortcut target, and add the 187 220 // description. 188 psl->SetPath(iconDestination );189 190 psl->SetDescription(description );221 psl->SetPath(iconDestination.c_str()); 222 223 psl->SetDescription(description.c_str()); 191 224 192 225 // Query IShellLink for the IPersistFile interface for saving the … … 214 247 // ensure that the requisite group is active; the add icon command will 215 248 // use the active group. 216 sprintf(buffer, "[ShowGroup(%s,5)]", groupName );249 sprintf(buffer, "[ShowGroup(%s,5)]", groupName.c_str()); 217 250 if (!DDEShellCommand(this->instance, buffer)) 218 251 { // TODO: articulate/determine possible errors; expand error handling … … 221 254 222 255 // and now add the item itself to the active (given) group 223 sprintf(buffer, "[AddItem(%s,%s)]", iconDestination , iconName);256 sprintf(buffer, "[AddItem(%s,%s)]", iconDestination.c_str(), iconName.c_str()); 224 257 if (!DDEShellCommand(this->instance, buffer)) 225 258 { // TODO: again work out what the problems could be … … 228 261 reply = true; 229 262 } 263 264 if (reply) 265 { this->logAction("ProgManAddItem", groupName, iconName, iconDestination); 266 } 230 267 return reply; 231 268 } 232 269 233 bool gsProgramManager::removeProgramGroup( const char *groupName)270 bool gsProgramManager::removeProgramGroup(string groupName) 234 271 { //CreateGroup(groupName); 235 272 char buffer[256]; … … 255 292 else 256 293 { // add using program manager DDE 257 sprintf(buffer, "[DeleteGroup (%s)]", groupName );294 sprintf(buffer, "[DeleteGroup (%s)]", groupName.c_str()); 258 295 if (!DDEShellCommand(this->instance, buffer)) 259 296 { // flag error by returning false … … 264 301 } 265 302 266 bool gsProgramManager::removeIcon( const char *groupName, // group of the icon267 const char *iconName) // name of the icon303 bool gsProgramManager::removeIcon(string groupName, // group of the icon 304 string iconName) // name of the icon 268 305 { bool reply = false; 269 306 char buffer[MAX_PATH]; … … 281 318 282 319 SHGetPathFromIDList(pidl, buffer); 283 fullPath = new FilePath(4, buffer, groupName , iconName, "!.lnk");320 fullPath = new FilePath(4, buffer, groupName.c_str(), iconName.c_str(), "!.lnk"); 284 321 285 322 // TODO: delete file … … 290 327 // ensure that the requisite group is active; the add icon command will 291 328 // use the active group. 292 sprintf(buffer, "[ShowGroup(%s,5)]", groupName );329 sprintf(buffer, "[ShowGroup(%s,5)]", groupName.c_str()); 293 330 if (!DDEShellCommand(this->instance, buffer)) 294 331 { // TODO: articulate/determine possible errors; expand error handling … … 297 334 298 335 // and now add the item itself to the active (given) group 299 sprintf(buffer, "[DeleteItem(%s)]", iconName );336 sprintf(buffer, "[DeleteItem(%s)]", iconName.c_str()); 300 337 if (!DDEShellCommand(this->instance, buffer)) 301 338 { // TODO: again work out what the problems could be
Note:
See TracChangeset
for help on using the changeset viewer.