Ignore:
Timestamp:
Jun 26, 2009, 4:43:50 PM (15 years ago)
Author:
ronosman
Message:

Feature 1036 added. Rename a category from category list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm

    r3461 r3466  
    6060             wxTR_HIDE_ROOT
    6161             wxTR_HAS_BUTTONS
     62             wxTR_EDIT_LABELS
    6263             wxMAXIMIZE
    6364             wxOK
     
    350351          EVT_MENU
    351352          EVT_TREE_SEL_CHANGED
     353          EVT_TREE_END_LABEL_EDIT
    352354          EVT_CLOSE
    353355          EVT_LIST_END_LABEL_EDIT
     
    11851187           wxBORDER_NONE|
    11861188           wxCLIP_CHILDREN|
    1187 #           wxTR_MULTIPLE|
    1188 #           wxTR_EXTENDED|
    1189            wxTR_HAS_BUTTONS
    1190 #           wxTR_HIDE_ROOT   
     1189           wxTR_HAS_BUTTONS|
     1190           wxTR_EDIT_LABELS
    11911191        )
    11921192    );
     
    14111411    EVT_TREE_SEL_CHANGED( $self, $self->tree, \&OnTreeSelChanged );
    14121412    EVT_TREE_ITEM_RIGHT_CLICK( $self, $self->tree, \&OnTreeItemRightClick );
     1413    EVT_TREE_END_LABEL_EDIT( $self, $self->tree, \&OnTreeEndLabelEdit );
    14131414
    14141415    EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \&OnImageViewerEndLabelEdit );
     
    15431544}
    15441545
     1546sub OnTreeEndLabelEdit {
     1547    my( $self, $event ) = @_;
     1548
     1549
     1550    my $category = $self->tree->GetPlData($event->GetItem);
     1551    my $category_id;
     1552   
     1553    $category_id = $category->{id} if 'HASH' eq ref($category) ;
     1554    my $comment;
     1555    my ( $success, $status_msg, $content ) = $self->pwg->SetInfoCategories( $event->GetLabel, $comment, $category_id);
     1556
     1557    my $ok = 1;
     1558   
     1559    if(!$success){
     1560        $ok = 0;
     1561    }
     1562
     1563    if('fail' eq $content->{stat}){
     1564        $ok = 0;
     1565    }
     1566
     1567    # method call failed
     1568    if(!$ok){
     1569        $event->Veto;
     1570        Wx::MessageBox(
     1571            sprintf(
     1572                "%s %s",
     1573                gettext("Update failed : "),
     1574                $status_msg
     1575            ),
     1576            gettext("Piwigo update error"),
     1577            wxOK | wxICON_EXCLAMATION,
     1578        );
     1579        Wx::LogMessage("%s\n\n%s", Dumper($content), gettext("This function is not available. A Piwigo upgrade may resolve this issue."));
     1580    }
     1581}
    15451582
    15461583sub OnImageViewerItemRightClick {
     
    15811618    my $dialog = Wx::TextEntryDialog->new(
    15821619        $self,
    1583         sprintf("%s name :", wxTheApp->branding->{Category}),
    1584         sprintf("Add new %s", wxTheApp->branding->{category}),
    1585         sprintf("New %s", wxTheApp->branding->{category}),
     1620        wxTheApp->branding->{'Category name'},
     1621        wxTheApp->branding->{'Add new category'},
     1622        wxTheApp->branding->{'New category'},
    15861623    );
    15871624
Note: See TracChangeset for help on using the changeset viewer.