aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/TablesList.m71
1 files changed, 54 insertions, 17 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index d8291598..4da85d7f 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -309,6 +309,7 @@
[alert setAlertStyle:NSCriticalAlertStyle];
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
+
NSString *tblTypes;
unsigned currentIndex = [indexes lastIndex];
@@ -326,19 +327,37 @@
[alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'. This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [tables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
- int tblTypesChecksum = 0;
+
+ BOOL areTableTypeEqual = YES;
+ int lastType = [[tableTypes objectAtIndex:currentIndex] intValue];
while (currentIndex != NSNotFound)
{
- tblTypesChecksum += [[tableTypes objectAtIndex:currentIndex] intValue];
+ if([[tableTypes objectAtIndex:currentIndex] intValue]!=lastType)
+ {
+ areTableTypeEqual = NO;
+ break;
+ }
currentIndex = [indexes indexLessThanIndex:currentIndex];
}
-
- if(tblTypesChecksum == 0)
- tblTypes = NSLocalizedString(@"tables", @"tables");
- else if(tblTypesChecksum == [indexes count])
- tblTypes = NSLocalizedString(@"views", @"views");
- else
- tblTypes = NSLocalizedString(@"tables/views", @"tables/views");
+ if(areTableTypeEqual)
+ {
+ switch(lastType) {
+ case SP_TABLETYPE_TABLE:
+ tblTypes = NSLocalizedString(@"tables", @"tables");
+ break;
+ case SP_TABLETYPE_VIEW:
+ tblTypes = NSLocalizedString(@"views", @"views");
+ break;
+ case SP_TABLETYPE_PROC:
+ tblTypes = NSLocalizedString(@"procedures", @"procedures");
+ break;
+ case SP_TABLETYPE_FUNC:
+ tblTypes = NSLocalizedString(@"functions", @"functions");
+ break;
+ }
+
+ } else
+ tblTypes = NSLocalizedString(@"items", @"items");
[alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete selected %@?", @"delete tables/views message"), tblTypes]];
[alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %@. This operation cannot be undone.", @"delete tables/views informative message"), tblTypes]];
@@ -948,18 +967,36 @@
// Set gear menu items Remove/Duplicate table/view according to the table types
NSIndexSet *indexes = [tablesListView selectedRowIndexes];
unsigned currentIndex = [indexes lastIndex];
- int tblTypesChecksum = 0;
+ BOOL areTableTypeEqual = YES;
+ int lastType = [[tableTypes objectAtIndex:currentIndex] intValue];
while (currentIndex != NSNotFound)
{
- tblTypesChecksum += [[tableTypes objectAtIndex:currentIndex] intValue];
+ if([[tableTypes objectAtIndex:currentIndex] intValue]!=lastType)
+ {
+ areTableTypeEqual = NO;
+ break;
+ }
currentIndex = [indexes indexLessThanIndex:currentIndex];
}
- if(tblTypesChecksum == 0)
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove tables", @"remove tables menu title")];
- else if(tblTypesChecksum == [indexes count])
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove views", @"remove views menu title")];
- else
- [removeTableMenuItem setTitle:NSLocalizedString(@"Remove tables/views", @"remove tables/views menu title")];
+ if(areTableTypeEqual)
+ {
+ switch(lastType) {
+ case SP_TABLETYPE_TABLE:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove tables", @"remove tables menu title")];
+ break;
+ case SP_TABLETYPE_VIEW:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove views", @"remove views menu title")];
+ break;
+ case SP_TABLETYPE_PROC:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove procedures", @"remove procedures menu title")];
+ break;
+ case SP_TABLETYPE_FUNC:
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove functions", @"remove functions menu title")];
+ break;
+ }
+
+ } else
+ [removeTableMenuItem setTitle:NSLocalizedString(@"Remove items", @"remove items menu title")];
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
ref='#n250'>250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502